diff 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
line wrap: on
line diff
--- a/liboctave/lo-cieee.c	Mon Jul 28 17:41:10 2008 +0200
+++ b/liboctave/lo-cieee.c	Thu Jun 05 21:58:14 2008 +0200
@@ -150,13 +150,36 @@
 #if defined (HAVE_ISNAN)
   lo_ieee_double t;
   t.value = x;
-  return (isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW) ? 1 : 0;
+  return (isnan (x) && t.word[lo_ieee_hw] == LO_IEEE_NA_HW 
+	  && t.word[lo_ieee_lw] == LO_IEEE_NA_LW) ? 1 : 0;
 #else
   return 0;
 #endif
 }
 
 int
+__lo_ieee_is_old_NA (double x)
+{
+#if defined (HAVE_ISNAN)
+  lo_ieee_double t;
+  t.value = x;
+  return (isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW_OLD 
+	  && t.word[lo_ieee_hw] == LO_IEEE_NA_HW_OLD) ? 1 : 0;
+#else
+  return 0;
+#endif
+}
+
+double
+__lo_ieee_replace_old_NA (double x)
+{
+  if (__lo_ieee_is_old_NA (x))
+    return lo_ieee_na_value ();
+  else
+    return x;
+}
+
+int
 __lo_ieee_is_NaN_or_NA (double x)
 {
   return __lo_ieee_isnan (x);