Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.c

raw
1 #ifndef SIGNAL_SUPPRESS
2 #include <signal.h>
3 #endif
4
5 void abort (void);
6 void exit (int);
7
8 float fnan = 1.0f/0.0f - 1.0f/0.0f;
9 float x = 1.0f;
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 (fnan == fnan)
29 abort ();
30 if (fnan != x)
31 x = 1.0;
32 else
33 abort ();
34
35 if (fnan < x)
36 abort ();
37 if (fnan > x)
38 abort ();
39 if (fnan <= x)
40 abort ();
41 if (fnan >= x)
42 abort ();
43 if (fnan == x)
44 abort ();
45 #endif
46 exit (0);
47 }