Rev 734 | Rev 1657 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 734 | Rev 804 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | 28 | ||
29 | #include<sftypes.h> |
29 | #include<sftypes.h> |
30 | #include<comparison.h> |
30 | #include<comparison.h> |
31 | 31 | ||
32 | inline int isFloat32NaN(float32 f) |
32 | inline int isFloat32NaN(float32 f) |
33 | { /* NaN : exp = 0xff and nonzero mantisa */ |
33 | { /* NaN : exp = 0xff and nonzero fraction */ |
34 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa)); |
34 | return ((f.parts.exp==0xFF)&&(f.parts.fraction)); |
35 | }; |
35 | }; |
36 | 36 | ||
37 | inline int isFloat64NaN(float64 d) |
37 | inline int isFloat64NaN(float64 d) |
38 | { /* NaN : exp = 0x7ff and nonzero mantisa */ |
38 | { /* NaN : exp = 0x7ff and nonzero fraction */ |
39 | return ((d.parts.exp==0x7FF)&&(d.parts.mantisa)); |
39 | return ((d.parts.exp==0x7FF)&&(d.parts.fraction)); |
40 | }; |
40 | }; |
41 | 41 | ||
42 | inline int isFloat32SigNaN(float32 f) |
42 | inline int isFloat32SigNaN(float32 f) |
43 | { /* SigNaN : exp = 0xff mantisa = 0xxxxx..x (binary), where at least one x is nonzero */ |
43 | { /* SigNaN : exp = 0xff fraction = 0xxxxx..x (binary), where at least one x is nonzero */ |
44 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa<0x400000)&&(f.parts.mantisa)); |
44 | return ((f.parts.exp==0xFF)&&(f.parts.fraction<0x400000)&&(f.parts.fraction)); |
45 | }; |
45 | }; |
46 | 46 | ||
47 | inline int isFloat64SigNaN(float64 d) |
47 | inline int isFloat64SigNaN(float64 d) |
48 | { /* SigNaN : exp = 0x7ff mantisa = 0xxxxx..x (binary), where at least one x is nonzero */ |
48 | { /* SigNaN : exp = 0x7ff fraction = 0xxxxx..x (binary), where at least one x is nonzero */ |
49 | return ((d.parts.exp==0x7FF)&&(d.parts.mantisa)&&(d.parts.mantisa<0x8000000000000ll)); |
49 | return ((d.parts.exp==0x7FF)&&(d.parts.fraction)&&(d.parts.fraction<0x8000000000000ll)); |
50 | }; |
50 | }; |
51 | 51 | ||
52 | inline int isFloat32Infinity(float32 f) |
52 | inline int isFloat32Infinity(float32 f) |
53 | { |
53 | { |
54 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa==0x0)); |
54 | return ((f.parts.exp==0xFF)&&(f.parts.fraction==0x0)); |
55 | }; |
55 | }; |
56 | 56 | ||
57 | inline int isFloat64Infinity(float64 d) |
57 | inline int isFloat64Infinity(float64 d) |
58 | { |
58 | { |
59 | return ((d.parts.exp==0x7FF)&&(d.parts.mantisa==0x0)); |
59 | return ((d.parts.exp==0x7FF)&&(d.parts.fraction==0x0)); |
60 | }; |
60 | }; |
61 | 61 | ||
62 | inline int isFloat32Zero(float32 f) |
62 | inline int isFloat32Zero(float32 f) |
63 | { |
63 | { |
64 | return (((f.binary) & 0x7FFFFFFF) == 0); |
64 | return (((f.binary) & 0x7FFFFFFF) == 0); |