13 0x1.ffffp127, FP_NORMAL,
14 -0x1.ffffp127, FP_NORMAL,
15 0x1p-127, FP_SUBNORMAL,
16 -0x1p-127, FP_SUBNORMAL,
22 static int ntf = sizeof tf / sizeof *tf;
32 0x1.ffffp1023, FP_NORMAL,
33 -0x1.ffffp1023, FP_NORMAL,
34 0x1p-1023, FP_SUBNORMAL,
35 -0x1p-1023, FP_SUBNORMAL,
41 static int ntd = sizeof td / sizeof *td;
51 0x1.ffffp16383L, FP_NORMAL,
52 -0x1.ffffp16383L, FP_NORMAL,
53 0x1p-16383L, FP_SUBNORMAL,
54 -0x1p-16383L, FP_SUBNORMAL,
60 static int ntl = sizeof tl / sizeof *tl;
63 void test_fpclassify()
67 for (i = 0; i < ntf; i++) {
68 if (fpclassify(tf[i].f) != tf[i].class)
69 error("%a want class %d got %d\n", tf[i].f, tf[i].class, fpclassify(tf[i].f));
70 if (!!isinf(tf[i].f) != (tf[i].class == FP_INFINITE))
71 error("%a want class %d got isinf %d\n", tf[i].f, tf[i].class, isinf(tf[i].f));
72 if (!!isnan(tf[i].f) != (tf[i].class == FP_NAN))
73 error("%a want class %d got isnan %d\n", tf[i].f, tf[i].class, isnan(tf[i].f));
74 if (!!isnormal(tf[i].f) != (tf[i].class == FP_NORMAL))
75 error("%a want class %d got isnormal %d\n", tf[i].f, tf[i].class, isnormal(tf[i].f));
76 if (!!isfinite(tf[i].f) != (tf[i].class > FP_INFINITE))
77 error("%a want class %d got isfinite %d\n", tf[i].f, tf[i].class, isfinite(tf[i].f));
80 for (i = 0; i < ntd; i++) {
81 if (fpclassify(td[i].f) != td[i].class)
82 error("%a want class %d got %d\n", td[i].f, td[i].class, fpclassify(td[i].f));
83 if (!!isinf(td[i].f) != (td[i].class == FP_INFINITE))
84 error("%a want class %d got isinf %d\n", td[i].f, td[i].class, isinf(td[i].f));
85 if (!!isnan(td[i].f) != (td[i].class == FP_NAN))
86 error("%a want class %d got isnan %d\n", td[i].f, td[i].class, isnan(td[i].f));
87 if (!!isnormal(td[i].f) != (td[i].class == FP_NORMAL))
88 error("%a want class %d got isnormal %d\n", td[i].f, td[i].class, isnormal(td[i].f));
89 if (!!isfinite(td[i].f) != (td[i].class > FP_INFINITE))
90 error("%a want class %d got isfinite %d\n", td[i].f, td[i].class, isfinite(td[i].f));
93 for (i = 0; i < ntl; i++) {
94 if (fpclassify(tl[i].f) != tl[i].class)
95 error("%La want class %d got %d\n", tl[i].f, tl[i].class, fpclassify(tl[i].f));
96 if (!!isinf(tl[i].f) != (tl[i].class == FP_INFINITE))
97 error("%La want class %d got isinf %d\n", tl[i].f, tl[i].class, isinf(tl[i].f));
98 if (!!isnan(tl[i].f) != (tl[i].class == FP_NAN))
99 error("%La want class %d got isnan %d\n", tl[i].f, tl[i].class, isnan(tl[i].f));
100 if (!!isnormal(tl[i].f) != (tl[i].class == FP_NORMAL))
101 error("%La want class %d got isnormal %d\n", tl[i].f, tl[i].class, isnormal(tl[i].f));
102 if (!!isfinite(tl[i].f) != (tl[i].class > FP_INFINITE))
103 error("%La want class %d got isfinite %d\n", tl[i].f, tl[i].class, isfinite(tl[i].f));