Restore #include "progname.h"
[gnulib.git] / tests / test-frexp.c
index 912ba20..9ce989b 100644 (file)
 #include <math.h>
 
 #include <float.h>
+#include <stdio.h>
 #include <stdlib.h>
 
-#define ASSERT(expr) if (!(expr)) abort ();
+#include "isnan.h"
+
+#define ASSERT(expr) \
+  do                                                                        \
+    {                                                                       \
+      if (!(expr))                                                          \
+        {                                                                   \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          abort ();                                                         \
+        }                                                                   \
+    }                                                                       \
+  while (0)
 
 /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0.  */
 #ifdef __DECC
@@ -64,7 +76,7 @@ main ()
     double mantissa;
     x = NaN ();
     mantissa = frexp (x, &exp);
-    ASSERT (mantissa != mantissa);
+    ASSERT (isnan (mantissa));
   }
 
   { /* Positive infinity.  */
@@ -90,6 +102,7 @@ main ()
     mantissa = frexp (x, &exp);
     ASSERT (exp == 0);
     ASSERT (mantissa == x);
+    ASSERT (!signbit (mantissa));
   }
 
   { /* Negative zero.  */
@@ -99,6 +112,7 @@ main ()
     mantissa = frexp (x, &exp);
     ASSERT (exp == 0);
     ASSERT (mantissa == x);
+    ASSERT (signbit (mantissa));
   }
 
   for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)