Mercurial > octave-nkf
comparison liboctave/util/lo-ieee.h @ 18540:89bd70fae066 gui-release
fix initialization problem for Inf, NaN, and NA values (bug #41667)
* lo-cieee.c: Move function definitions to lo-ieee.cc and delete file.
* liboctave/util/module.mk (UTIL_C_SRC): Remove lo-cieee.c from the
list.
* lo-ieee.h (octave_Inf, octave_Float_Inf, octave_NA, octave_Float_NA,
octave_NaN, octave_Float_NaN): Define as macros that expand to
function calls instead of using global variables.
* lo-ieee.cc (lo_inf, lo_nan, lo_na, lo_float_inf, lo_float_nan,
lo_float_na): New static variables.
(octave_ieee_init): Set internal static variables here.
(__lo_ieee_isnan, __lo_ieee_finite, __lo_ieee_isinf,
__lo_ieee_signbit, __lo_ieee_float_isnan, __lo_ieee_float_finite,
__lo_ieee_float_isinf, __lo_ieee_float_signbit):
Use std:: functions if possible, otherwise rely on gnulib.
(lo_ieee_inf_value, lo_ieee_na_value, lo_ieee_nan_value,
lo_ieee_float_inf_value, lo_ieee_float_na_value,
lo_ieee_float_nan_value): Call init function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 04 Mar 2014 10:49:31 -0500 |
parents | ebb3ef964372 |
children | 5b263e517c95 |
comparison
equal
deleted
inserted
replaced
18536:4cf930a64fad | 18540:89bd70fae066 |
---|---|
26 #ifdef __cplusplus | 26 #ifdef __cplusplus |
27 extern "C" { | 27 extern "C" { |
28 #endif | 28 #endif |
29 | 29 |
30 /* Octave's idea of infinity. */ | 30 /* Octave's idea of infinity. */ |
31 extern OCTAVE_API double octave_Inf; | 31 #define octave_Inf (lo_ieee_inf_value ()) |
32 | 32 |
33 /* Octave's idea of a missing value. */ | 33 /* Octave's idea of a missing value. */ |
34 extern OCTAVE_API double octave_NA; | 34 #define octave_NA (lo_ieee_na_value ()) |
35 | 35 |
36 /* Octave's idea of not a number. */ | 36 /* Octave's idea of not a number. */ |
37 extern OCTAVE_API double octave_NaN; | 37 #define octave_NaN (lo_ieee_nan_value ()) |
38 | 38 |
39 /* Octave's idea of infinity. */ | 39 /* Octave's idea of infinity. */ |
40 extern OCTAVE_API float octave_Float_Inf; | 40 #define octave_Float_Inf (lo_ieee_float_inf_value ()) |
41 | 41 |
42 /* Octave's idea of a missing value. */ | 42 /* Octave's idea of a missing value. */ |
43 extern OCTAVE_API float octave_Float_NA; | 43 #define octave_Float_NA (lo_ieee_float_na_value ()) |
44 | 44 |
45 /* Octave's idea of not a number. */ | 45 /* Octave's idea of not a number. */ |
46 extern OCTAVE_API float octave_Float_NaN; | 46 #define octave_Float_NaN (lo_ieee_float_nan_value ()) |
47 | 47 |
48 /* FIXME -- this code assumes that a double has twice the | 48 /* FIXME -- this code assumes that a double has twice the |
49 number of bits as an int */ | 49 number of bits as an int */ |
50 | |
51 extern OCTAVE_API int lo_ieee_hw; | |
52 extern OCTAVE_API int lo_ieee_lw; | |
53 | 50 |
54 typedef union | 51 typedef union |
55 { | 52 { |
56 double value; | 53 double value; |
57 unsigned int word[2]; | 54 unsigned int word[2]; |