6 #define test(type, name, op) \
7 static void test_##type##_##name(type a, type b) { \
9 printf("%f " #op " %f = true\n", a, b); \
11 printf("%f " #op " %f = false\n", a, b); \
14 #define testu(type, op) \
15 static void test_##type##_##op(type a, type b) { \
17 printf(#op "(%f, %f) = true\n", a, b); \
19 printf(#op "(%f, %f) = false\n", a, b); \
22 #define testnu(type, op) \
23 static void test_##type##_not##op(type a, type b) { \
25 printf("!" #op "(%f, %f) = true\n", a, b); \
27 printf("!" #op "(%f, %f) = false\n", a, b); \
37 testu(float, isgreater)
38 testu(float, isgreaterequal)
40 testu(float, islessequal)
41 testu(float, islessgreater)
42 testu(float, isunordered)
44 testnu(float, isgreater)
45 testnu(float, isgreaterequal)
47 testnu(float, islessequal)
48 testnu(float, islessgreater)
49 testnu(float, isunordered)
51 /*-------------------------- */
59 testu(double, isgreater)
60 testu(double, isgreaterequal)
62 testu(double, islessequal)
63 testu(double, islessgreater)
64 testu(double, isunordered)
66 testnu(double, isgreater)
67 testnu(double, isgreaterequal)
68 testnu(double, isless)
69 testnu(double, islessequal)
70 testnu(double, islessgreater)
71 testnu(double, isunordered)
75 double dA = 3.0, dB = 4.0, dNan = NAN;
76 float fA = 3.0, fB = 4.0, fNan = NAN;
79 #define test(type, name, a, b) test_##type##_##name(a,b)
81 test(float, l, fA, fB);
82 test(float, le, fA, fB);
83 test(float, eq, fA, fB);
84 test(float, ge, fA, fB);
85 test(float, g, fA, fB);
86 test(float, lg, fA, fB);
87 test(float, l, fA, fNan);
88 test(float, le, fA, fNan);
89 test(float, eq, fA, fNan);
90 test(float, ge, fA, fNan);
91 test(float, g, fA, fNan);
92 test(float, lg, fA, fNan);
93 test(float, lg, fNan, fNan);
95 test(float, isgreater, fA, fB);
96 test(float, isgreaterequal, fA, fB);
97 test(float, isless, fA, fB);
98 test(float, islessequal, fA, fB);
99 test(float, islessgreater, fA, fB);
100 test(float, isunordered, fA, fB);
101 test(float, isgreater, fA, fNan);
102 test(float, isgreaterequal, fA, fNan);
103 test(float, isless, fA, fNan);
104 test(float, islessequal, fA, fNan);
105 test(float, islessgreater, fA, fNan);
106 test(float, isunordered, fA, fNan);
107 test(double, islessgreater, fA, fB);
108 test(float, islessgreater, fNan, fNan);
110 test(float, notisgreater, fA, fNan);
111 test(float, notisgreaterequal, fA, fNan);
112 test(float, notisless, fA, fNan);
113 test(float, notislessequal, fA, fNan);
114 test(float, notislessgreater, fA, fNan);
115 test(float, notisunordered, fA, fNan);
117 test(double, l, dA, dB);
118 test(double, le, dA, dB);
119 test(double, eq, dA, dB);
120 test(double, ge, dA, dB);
121 test(double, g, dA, dB);
122 test(double, lg, dA, dB);
123 test(double, l, dA, dNan);
124 test(double, le, dA, dNan);
125 test(double, eq, dA, dNan);
126 test(double, ge, dA, dNan);
127 test(double, g, dA, dNan);
128 test(double, lg, dA, dNan);
129 test(double, lg, dNan, dNan);
131 test(double, isgreater, dA, dB);
132 test(double, isgreaterequal, dA, dB);
133 test(double, isless, dA, dB);
134 test(double, islessequal, dA, dB);
135 test(double, islessgreater, dA, dB);
136 test(double, isunordered, dA, dB);
137 test(double, isgreater, dA, dNan);
138 test(double, isgreaterequal, dA, dNan);
139 test(double, isless, dA, dNan);
140 test(double, islessequal, dA, dNan);
141 test(double, islessgreater, dA, dNan);
142 test(double, isunordered, dA, dNan);
143 test(double, islessgreater, dA, dB);
144 test(double, islessgreater, dNan, dNan);
146 test(double, notisgreater, dA, dNan);
147 test(double, notisgreaterequal, dA, dNan);
148 test(double, notisless, dA, dNan);
149 test(double, notislessequal, dA, dNan);
150 test(double, notislessgreater, dA, dNan);
151 test(double, notisunordered, dA, dNan);