blob: dafd95835c8a6cfbd4dd1be65aec10373041439e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
extern void abort (void);
void test(double f, double i)
{
if (f == __builtin_inf())
abort ();
if (f == -__builtin_inf())
abort ();
if (i == -__builtin_inf())
abort ();
if (i != __builtin_inf())
abort ();
if (f >= __builtin_inf())
abort ();
if (f > __builtin_inf())
abort ();
if (i > __builtin_inf())
abort ();
if (f <= -__builtin_inf())
abort ();
if (f < -__builtin_inf())
abort ();
}
void testf(float f, float i)
{
#ifndef __SPU__
/* The SPU single-precision floating point format does not support Inf. */
if (f == __builtin_inff())
abort ();
if (f == -__builtin_inff())
abort ();
if (i == -__builtin_inff())
abort ();
if (i != __builtin_inff())
abort ();
if (f >= __builtin_inff())
abort ();
if (f > __builtin_inff())
abort ();
if (i > __builtin_inff())
abort ();
if (f <= -__builtin_inff())
abort ();
if (f < -__builtin_inff())
abort ();
#endif
}
void testl(long double f, long double i)
{
if (f == __builtin_infl())
abort ();
if (f == -__builtin_infl())
abort ();
if (i == -__builtin_infl())
abort ();
if (i != __builtin_infl())
abort ();
if (f >= __builtin_infl())
abort ();
if (f > __builtin_infl())
abort ();
if (i > __builtin_infl())
abort ();
if (f <= -__builtin_infl())
abort ();
if (f < -__builtin_infl())
abort ();
}
int main()
{
test (34.0, __builtin_inf());
testf (34.0f, __builtin_inff());
testl (34.0l, __builtin_infl());
return 0;
}
|