comparison liboctave/lo-cieee.c @ 7991:139f47cf17ab

Change NA value to support single to double precision conversion
author David Bateman <dbateman@free.fr>
date Thu, 05 Jun 2008 21:58:14 +0200
parents 87865ed7405f
children eb63fbe60fab
comparison
equal deleted inserted replaced
7990:86dae6e5b83c 7991:139f47cf17ab
148 __lo_ieee_is_NA (double x) 148 __lo_ieee_is_NA (double x)
149 { 149 {
150 #if defined (HAVE_ISNAN) 150 #if defined (HAVE_ISNAN)
151 lo_ieee_double t; 151 lo_ieee_double t;
152 t.value = x; 152 t.value = x;
153 return (isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW) ? 1 : 0; 153 return (isnan (x) && t.word[lo_ieee_hw] == LO_IEEE_NA_HW
154 #else 154 && t.word[lo_ieee_lw] == LO_IEEE_NA_LW) ? 1 : 0;
155 return 0; 155 #else
156 #endif 156 return 0;
157 #endif
158 }
159
160 int
161 __lo_ieee_is_old_NA (double x)
162 {
163 #if defined (HAVE_ISNAN)
164 lo_ieee_double t;
165 t.value = x;
166 return (isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW_OLD
167 && t.word[lo_ieee_hw] == LO_IEEE_NA_HW_OLD) ? 1 : 0;
168 #else
169 return 0;
170 #endif
171 }
172
173 double
174 __lo_ieee_replace_old_NA (double x)
175 {
176 if (__lo_ieee_is_old_NA (x))
177 return lo_ieee_na_value ();
178 else
179 return x;
157 } 180 }
158 181
159 int 182 int
160 __lo_ieee_is_NaN_or_NA (double x) 183 __lo_ieee_is_NaN_or_NA (double x)
161 { 184 {