DEFINITIONS
This source file includes following functions.
- isinf
- zero
- one
- inf
- isinf
1
2
3 #ifdef __osf__
4
5 #define _IEEE 1
6 #include <nan.h>
7
8 int
9 isinf(n)
10 double n;
11 {
12 if (IsNANorINF(n) && IsINF(n)) {
13 return 1;
14 } else {
15 return 0;
16 }
17 }
18
19 #else
20
21 #include "config.h"
22 #ifdef HAVE_STRING_H
23 # include <string.h>
24 #else
25 # include <strings.h>
26 #endif
27
28 static double zero() { return 0.0; }
29 static double one() { return 1.0; }
30 static double inf() { return one() / zero(); }
31
32 int
33 isinf(n)
34 double n;
35 {
36 static double pinf = 0.0;
37 static double ninf = 0.0;
38
39 if (pinf == 0.0) {
40 pinf = inf();
41 ninf = -pinf;
42 }
43 return memcmp(&n, &pinf, sizeof n) == 0
44 || memcmp(&n, &ninf, sizeof n) == 0;
45 }
46 #endif