Octave-Forge - Extra packages for GNU Octave | |
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code |
00001 /* 00002 00003 Copyright (C) 1996, 1997, 2002, 2003, 2004, 2005, 2006, 2007, 2008 00004 John W. Eaton 00005 00006 This file is part of Octave. 00007 00008 Octave is free software; you can redistribute it and/or modify it 00009 under the terms of the GNU General Public License as published by the 00010 Free Software Foundation; either version 3 of the License, or (at your 00011 option) any later version. 00012 00013 Octave is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00015 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00016 for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with Octave; see the file COPYING. If not, see 00020 <http://www.gnu.org/licenses/>. 00021 00022 */ 00023 00024 #if !defined (octave_liboctave_ieee_h) 00025 #define octave_liboctave_ieee_h 1 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 /* Octave's idea of infinity. */ 00032 extern OCTAVE_API double octave_Inf; 00033 00034 /* Octave's idea of a missing value. */ 00035 extern OCTAVE_API double octave_NA; 00036 00037 /* Octave's idea of not a number. */ 00038 extern OCTAVE_API double octave_NaN; 00039 00040 /* Octave's idea of infinity. */ 00041 extern OCTAVE_API float octave_Float_Inf; 00042 00043 /* Octave's idea of a missing value. */ 00044 extern OCTAVE_API float octave_Float_NA; 00045 00046 /* Octave's idea of not a number. */ 00047 extern OCTAVE_API float octave_Float_NaN; 00048 00049 /* FIXME -- this code assumes that a double has twice the 00050 number of bits as an int */ 00051 00052 extern OCTAVE_API int lo_ieee_hw; 00053 extern OCTAVE_API int lo_ieee_lw; 00054 00055 typedef union 00056 { 00057 double value; 00058 unsigned int word[2]; 00059 } lo_ieee_double; 00060 00061 typedef union 00062 { 00063 float value; 00064 unsigned int word; 00065 } lo_ieee_float; 00066 00067 #define LO_IEEE_NA_HW_OLD 0x7ff00000 00068 #define LO_IEEE_NA_LW_OLD 1954 00069 #define LO_IEEE_NA_HW 0x7FF840F4 00070 #define LO_IEEE_NA_LW 0x40000000 00071 #define LO_IEEE_NA_FLOAT 0x7FC207A2 00072 00073 00074 extern OCTAVE_API void octave_ieee_init (void); 00075 00076 #if defined (SCO) 00077 extern int __isnan (double); 00078 extern int __isinf (double); 00079 extern int __isnanf (float); 00080 extern int __isinff (float); 00081 00082 #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x)) 00083 #define isinf(x) (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) 00084 #endif 00085 00086 extern OCTAVE_API int __lo_ieee_isnan (double x); 00087 extern OCTAVE_API int __lo_ieee_finite (double x); 00088 extern OCTAVE_API int __lo_ieee_isinf (double x); 00089 00090 extern OCTAVE_API int __lo_ieee_is_NA (double); 00091 extern OCTAVE_API int __lo_ieee_is_old_NA (double); 00092 extern OCTAVE_API int __lo_ieee_is_NaN_or_NA (double) GCC_ATTR_DEPRECATED; 00093 extern OCTAVE_API double __lo_ieee_replace_old_NA (double); 00094 00095 extern OCTAVE_API double lo_ieee_inf_value (void); 00096 extern OCTAVE_API double lo_ieee_na_value (void); 00097 extern OCTAVE_API double lo_ieee_nan_value (void); 00098 00099 extern OCTAVE_API int __lo_ieee_signbit (double); 00100 00101 extern OCTAVE_API int __lo_ieee_float_isnan (float x); 00102 extern OCTAVE_API int __lo_ieee_float_finite (float x); 00103 extern OCTAVE_API int __lo_ieee_float_isinf (float x); 00104 00105 extern OCTAVE_API int __lo_ieee_float_is_NA (float); 00106 extern OCTAVE_API int __lo_ieee_float_is_NaN_or_NA (float) GCC_ATTR_DEPRECATED; 00107 00108 extern OCTAVE_API float lo_ieee_float_inf_value (void); 00109 extern OCTAVE_API float lo_ieee_float_na_value (void); 00110 extern OCTAVE_API float lo_ieee_float_nan_value (void); 00111 00112 extern OCTAVE_API int __lo_ieee_float_signbit (float); 00113 00114 #ifdef __cplusplus 00115 } 00116 #endif 00117 00118 #define lo_ieee_isnan(x) (sizeof (x) == sizeof (float) ? \ 00119 __lo_ieee_float_isnan (x) : __lo_ieee_isnan (x)) 00120 #define lo_ieee_finite(x) (sizeof (x) == sizeof (float) ? \ 00121 __lo_ieee_float_finite (x) : __lo_ieee_finite (x)) 00122 #define lo_ieee_isinf(x) (sizeof (x) == sizeof (float) ? \ 00123 __lo_ieee_float_isinf (x) : __lo_ieee_isinf (x)) 00124 00125 00126 #define lo_ieee_is_NA(x) (sizeof (x) == sizeof (float) ? \ 00127 __lo_ieee_float_is_NA (x) : __lo_ieee_is_NA (x)) 00128 #define lo_ieee_is_NaN_or_NA(x) (sizeof (x) == sizeof (float) ? \ 00129 __lo_ieee_float_is_NaN_or_NA (x) : __lo_ieee_is_NaN_or_NA (x)) 00130 #define lo_ieee_signbit(x) (sizeof (x) == sizeof (float) ? \ 00131 __lo_ieee_float_signbit (x) : __lo_ieee_signbit (x)) 00132 00133 #endif 00134 00135 /* 00136 ;;; Local Variables: *** 00137 ;;; mode: C++ *** 00138 ;;; End: *** 00139 */