1 /* Tests for _FloatN / _FloatNx types: compile and execution tests for
2 type-generic built-in functions. Before including this file,
3 define WIDTH as the value N; define EXT to 1 for _FloatNx and 0 for
6 #define __STDC_WANT_IEC_60559_TYPES_EXT__
9 #define CONCATX(X, Y) X ## Y
10 #define CONCAT(X, Y) CONCATX (X, Y)
11 #define CONCAT3(X, Y, Z) CONCAT (CONCAT (X, Y), Z)
12 #define CONCAT4(W, X, Y, Z) CONCAT (CONCAT (CONCAT (W, X), Y), Z)
15 # define TYPE CONCAT3 (_Float, WIDTH, x)
16 # define CST(C) CONCAT4 (C, f, WIDTH, x)
17 # define TRUE_MIN CONCAT3 (FLT, WIDTH, X_TRUE_MIN)
19 # define TYPE CONCAT (_Float, WIDTH)
20 # define CST(C) CONCAT3 (C, f, WIDTH)
21 # define TRUE_MIN CONCAT3 (FLT, WIDTH, _TRUE_MIN)
24 extern void exit (int);
25 extern void abort (void);
27 volatile TYPE inf
= __builtin_inf (), nanval
= __builtin_nan ("");
28 volatile TYPE zero
= CST (0.0), negzero
= -CST (0.0), one
= CST (1.0);
29 volatile TYPE true_min
= TRUE_MIN
;
34 if (__builtin_signbit (inf
) != 0)
36 if (__builtin_signbit (zero
) != 0)
38 if (__builtin_signbit (negzero
) == 0)
40 if (__builtin_isfinite (nanval
) != 0)
42 if (__builtin_isfinite (inf
) != 0)
44 if (__builtin_isfinite (one
) == 0)
46 if (__builtin_isinf (nanval
) != 0)
48 if (__builtin_isinf (inf
) == 0)
50 if (__builtin_isnan (nanval
) == 0)
52 if (__builtin_isnan (inf
) != 0)
54 if (__builtin_isnormal (inf
) != 0)
56 if (__builtin_isnormal (one
) == 0)
58 if (__builtin_isnormal (nanval
) != 0)
60 if (__builtin_isnormal (zero
) != 0)
62 if (__builtin_isnormal (true_min
) != 0)
64 if (__builtin_islessequal (zero
, one
) != 1)
66 if (__builtin_islessequal (one
, zero
) != 0)
68 if (__builtin_islessequal (zero
, negzero
) != 1)
70 if (__builtin_islessequal (zero
, nanval
) != 0)
72 if (__builtin_isless (zero
, one
) != 1)
74 if (__builtin_isless (one
, zero
) != 0)
76 if (__builtin_isless (zero
, negzero
) != 0)
78 if (__builtin_isless (zero
, nanval
) != 0)
80 if (__builtin_isgreaterequal (zero
, one
) != 0)
82 if (__builtin_isgreaterequal (one
, zero
) != 1)
84 if (__builtin_isgreaterequal (zero
, negzero
) != 1)
86 if (__builtin_isgreaterequal (zero
, nanval
) != 0)
88 if (__builtin_isgreater (zero
, one
) != 0)
90 if (__builtin_isgreater (one
, zero
) != 1)
92 if (__builtin_isgreater (zero
, negzero
) != 0)
94 if (__builtin_isgreater (zero
, nanval
) != 0)
96 if (__builtin_islessgreater (zero
, one
) != 1)
98 if (__builtin_islessgreater (one
, zero
) != 1)
100 if (__builtin_islessgreater (zero
, negzero
) != 0)
102 if (__builtin_islessgreater (zero
, nanval
) != 0)
104 if (__builtin_isunordered (zero
, one
) != 0)
106 if (__builtin_isunordered (one
, zero
) != 0)
108 if (__builtin_isunordered (zero
, negzero
) != 0)
110 if (__builtin_isunordered (zero
, nanval
) != 1)