nantest1.c
text/x-csrc
#include <math.h>
#include <float.h>
#include <stdio.h>
static double
get_float8_nan(void)
{
printf("computed NAN\n");
return (double) (0.0 / 0.0);
}
static double
get_float8_infinity(void)
{
#ifdef INFINITY
printf("defined INFINITY\n");
return (double) INFINITY;
#else
printf("computed INFINITY\n");
return (double) (HUGE_VAL * HUGE_VAL);
#endif
}
int main(void) {
double d;
d = get_float8_nan();
printf("%d %d\n", isnan(d), isinf(d));
d = get_float8_infinity();
printf("%d %d\n", isnan(d), isinf(d));
return 0;
}