#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
double mantissa;
x = NaN ();
mantissa = frexp (x, &exp);
- ASSERT (mantissa != mantissa);
+ ASSERT (isnan (mantissa));
}
{ /* Positive infinity. */
mantissa = frexp (x, &exp);
ASSERT (exp == 0);
ASSERT (mantissa == x);
+ ASSERT (!signbit (mantissa));
}
{ /* Negative zero. */
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)