blob: 7edd992aec976255e2b30267393392cecaa4a6fd (
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
|
float inf = 1.0f/0.0f;
float nnn = 1.0f/0.0f - 1.0f/0.0f;
float fin = 1.0f;
float neg = -1.0f;
float nn2;
int isnanf(), isfinitef(), signbitf();
void pvalue (char *str, float x)
{
union
{
float f;
unsigned int i;
}u;
printf("%s ", str);
u.f = x;
printf("%08x\n", u.i);
}
int
main()
{
if (!isnanf(nnn))
abort();
pvalue("nnn", nnn);
pvalue("inf", inf);
nn2 = inf - inf;
pvalue("inf - inf", nn2);
if (isnanf(fin))
abort();
if (isnanf(inf))
abort();
if (!isfinitef(fin))
abort();
if (isfinitef(nnn))
abort();
if (isfinitef(inf))
abort();
if (!signbitf(neg))
abort();
if (signbitf(fin))
abort();
if (signbitf(inf))
abort();
/*
if (signbitf(nnn))
abort();
*/
exit (0);
}
|