GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
lo-ieee.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2013 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <cstdlib>
28 
29 #include <limits>
30 
31 #include "lo-error.h"
32 #include "lo-ieee.h"
33 #include "mach-info.h"
34 
35 void
37 {
39 
40  switch (ff)
41  {
44  {
45  octave_NaN = std::numeric_limits<double>::quiet_NaN ();
46  octave_Inf = std::numeric_limits<double>::infinity ();
47 
48  octave_Float_NaN = std::numeric_limits<float>::quiet_NaN ();
49  octave_Float_Inf = std::numeric_limits<float>::infinity ();
50 
51  // The following is patterned after code in R.
52 
54  {
55  lo_ieee_hw = 0;
56  lo_ieee_lw = 1;
57  }
58  else
59  {
60  lo_ieee_hw = 1;
61  lo_ieee_lw = 0;
62  }
63 
67 
68  octave_NA = t.value;
69 
70  lo_ieee_float tf;
73  }
74  break;
75 
76  default:
77  // If the format is unknown, then you will probably not have a
78  // useful system, so we will abort here. Anyone wishing to
79  // experiment with building Octave on a system without IEEE
80  // floating point should be capable of removing this check and
81  // the configure test.
82  (*current_liboctave_error_handler)
83  ("lo_ieee_init: floating point format is not IEEE! Maybe DLAMCH is miscompiled, or you are using some strange system without IEEE floating point math?");
84  abort ();
85  }
86 }