This source file includes following definitions.
- numeric_equalf
- numeric_equald
- numeric_equall
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21 #include <math.h>
22
23 #ifndef NAN
24 # error NAN should be defined
25 choke me
26 #endif
27
28 #ifndef HUGE_VALF
29 # error HUGE_VALF should be defined
30 choke me
31 #endif
32
33 #ifndef HUGE_VAL
34 # error HUGE_VAL should be defined
35 choke me
36 #endif
37
38 #ifndef HUGE_VALL
39 # error HUGE_VALL should be defined
40 choke me
41 #endif
42
43 #ifndef FP_ILOGB0
44 # error FP_ILOGB0 should be defined
45 choke me
46 #endif
47
48 #ifndef FP_ILOGBNAN
49 # error FP_ILOGBNAN should be defined
50 choke me
51 #endif
52
53 #include <limits.h>
54
55 #include "macros.h"
56
57 #if 0
58
59 static float n = NAN;
60 #endif
61
62
63
64
65 static int
66 numeric_equalf (float x, float y)
67 {
68 return x == y;
69 }
70 static int
71 numeric_equald (double x, double y)
72 {
73 return x == y;
74 }
75 static int
76 numeric_equall (long double x, long double y)
77 {
78 return x == y;
79 }
80
81 int
82 main (void)
83 {
84 double d = NAN;
85 double zero = 0.0;
86 ASSERT (!numeric_equald (d, d));
87
88 d = HUGE_VAL;
89 ASSERT (numeric_equald (d, 1.0 / zero));
90
91 ASSERT (numeric_equalf (HUGE_VALF, HUGE_VALF + HUGE_VALF));
92
93 ASSERT (numeric_equald (HUGE_VAL, HUGE_VAL + HUGE_VAL));
94
95 ASSERT (numeric_equall (HUGE_VALL, HUGE_VALL + HUGE_VALL));
96
97
98 ASSERT (FP_ILOGB0 == INT_MIN || FP_ILOGB0 == - INT_MAX);
99
100
101 ASSERT (FP_ILOGBNAN == INT_MIN || FP_ILOGBNAN == INT_MAX);
102
103 return 0;
104 }