2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / ieee / fp-cmp-2.c
blob5d6538b9d7407fa5b606f1d5cce273e15a7f5629
1 #include <signal.h>
3 float fnan = 1.0f/0.0f - 1.0f/0.0f;
4 float x = 1.0f;
6 void leave ()
8 exit (0);
11 main ()
13 #if ! defined (__vax__) && ! defined (_CRAY)
14 /* Move this line earlier, for architectures (like alpha) that issue
15 SIGFPE on the first comparisons. */
16 #ifndef SIGNAL_SUPPRESS
17 /* Some machines catches a SIGFPE when a NaN is compared.
18 Let this test succeed o such machines. */
19 signal (SIGFPE, leave);
20 #endif
21 /* NaN is an IEEE unordered operand. All these test should be false. */
22 if (fnan == fnan)
23 abort ();
24 if (fnan != x)
25 x = 1.0;
26 else
27 abort ();
29 if (fnan < x)
30 abort ();
31 if (fnan > x)
32 abort ();
33 if (fnan <= x)
34 abort ();
35 if (fnan >= x)
36 abort ();
37 if (fnan == x)
38 abort ();
39 #endif
40 exit (0);