summaryrefslogtreecommitdiff
path: root/libm/ldouble/nantst.c
blob: 855a43b5aeb848582dda84dc48238e2b2ec6b999 (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
#include <stdio.h>
long double inf = 1.0f/0.0f;
long double nnn = 1.0f/0.0f - 1.0f/0.0f;
long double fin = 1.0f;
long double neg = -1.0f;
long double nn2;

int isnanl(), isfinitel(), signbitl();
void abort (void);
void exit (int);

void pvalue (char *str, long double x)
{
union
  {
    long double f;
    unsigned int i[3];
  }u;
int k;

printf("%s ", str);
u.f = x;
for (k = 0; k < 3; k++)
  printf("%08x ", u.i[k]);
printf ("\n");
}


int
main()
{

if (!isnanl(nnn))
  abort();
pvalue("nnn", nnn);
pvalue("inf", inf);
nn2 = inf - inf;
pvalue("inf - inf", nn2);
if (isnanl(fin))
  abort();
if (isnanl(inf))
  abort();
if (!isfinitel(fin))
  abort();
if (isfinitel(nnn))
  abort();
if (isfinitel(inf))
  abort();
if (!signbitl(neg))
  abort();
if (signbitl(fin))
  abort();
if (signbitl(inf))
  abort();
/*
if (signbitf(nnn))
  abort();
  */
exit (0);
return 0;
}