Guarantee a definition of NAN.
[gnulib.git] / lib / isnan.c
index a5ca38d..81f394d 100644 (file)
@@ -19,6 +19,7 @@
 #include <config.h>
 
 #include <float.h>
+#include <math.h>
 #include <string.h>
 
 #include "float+.h"
@@ -111,11 +112,10 @@ FUNC (DOUBLE x)
      also fails when constant-folding 0.0 / 0.0 even when constant-folding is
      not required.  The SGI MIPSpro C compiler complains about "floating-point
      operation result is out of range".  */
-  static DOUBLE zero = L_(0.0);
   memory_double nan;
   DOUBLE plus_inf = L_(1.0) / L_(0.0);
   DOUBLE minus_inf = -L_(1.0) / L_(0.0);
-  nan.value = zero / zero;
+  nan.value = NAN;
 #  else
   static memory_double nan = { L_(0.0) / L_(0.0) };
   static DOUBLE plus_inf = L_(1.0) / L_(0.0);