| 1 |
#ifndef SIGNAL_SUPPRESS |
| 2 |
#include <signal.h> |
| 3 |
#endif |
| 4 |
|
| 5 |
void abort (void); |
| 6 |
void exit (int); |
| 7 |
|
| 8 |
long double dnan = 1.0l/0.0l - 1.0l/0.0l; |
| 9 |
long double x = 1.0l; |
| 10 |
|
| 11 |
void leave () |
| 12 |
{ |
| 13 |
exit (0); |
| 14 |
} |
| 15 |
|
| 16 |
int |
| 17 |
main (void) |
| 18 |
{ |
| 19 |
#if ! defined (__vax__) && ! defined (_CRAY) |
| 20 |
/* Move this line earlier, for architectures (like alpha) that issue |
| 21 |
SIGFPE on the first comparisons. */ |
| 22 |
#ifndef SIGNAL_SUPPRESS |
| 23 |
/* Some machines catches a SIGFPE when a NaN is compared. |
| 24 |
Let this test succeed o such machines. */ |
| 25 |
signal (SIGFPE, leave); |
| 26 |
#endif |
| 27 |
/* NaN is an IEEE unordered operand. All these test should be false. */ |
| 28 |
if (dnan == dnan) |
| 29 |
abort (); |
| 30 |
if (dnan != x) |
| 31 |
x = 1.0; |
| 32 |
else |
| 33 |
abort (); |
| 34 |
|
| 35 |
if (dnan < x) |
| 36 |
abort (); |
| 37 |
if (dnan > x) |
| 38 |
abort (); |
| 39 |
if (dnan <= x) |
| 40 |
abort (); |
| 41 |
if (dnan >= x) |
| 42 |
abort (); |
| 43 |
if (dnan == x) |
| 44 |
abort (); |
| 45 |
#endif |
| 46 |
exit (0); |
| 47 |
} |