Rev 688 | Rev 734 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 688 | Rev 697 | ||
---|---|---|---|
Line 32... | Line 32... | ||
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 mantisa */ |
34 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa)); |
34 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa)); |
35 | }; |
35 | }; |
36 | 36 | ||
- | 37 | inline int isFloat64NaN(float64 d) |
|
- | 38 | { /* NaN : exp = 0x7ff and nonzero mantisa */ |
|
- | 39 | return ((d.parts.exp==0x7FF)&&(d.parts.mantisa)); |
|
- | 40 | }; |
|
- | 41 | ||
37 | inline int isFloat32SigNaN(float32 f) |
42 | inline int isFloat32SigNaN(float32 f) |
38 | { /* SigNaN : exp = 0xff mantisa = 1xxxxx..x (binary), where at least one x is nonzero */ |
43 | { /* SigNaN : exp = 0xff mantisa = 1xxxxx..x (binary), where at least one x is nonzero */ |
39 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa>0x400000)); |
44 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa>0x400000)); |
40 | }; |
45 | }; |
41 | 46 | ||
- | 47 | inline int isFloat64SigNaN(float64 d) |
|
- | 48 | { /* SigNaN : exp = 0x7ff mantisa = 1xxxxx..x (binary), where at least one x is nonzero */ |
|
- | 49 | return ((d.parts.exp==0x7FF)&&(d.parts.mantisa>0x8000000000000ll)); |
|
- | 50 | }; |
|
- | 51 | ||
42 | inline int isFloat32Infinity(float32 f) |
52 | inline int isFloat32Infinity(float32 f) |
43 | { |
53 | { |
44 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa==0x0)); |
54 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa==0x0)); |
45 | }; |
55 | }; |
46 | 56 | ||
- | 57 | inline int isFloat64Infinity(float64 d) |
|
- | 58 | { |
|
- | 59 | return ((d.parts.exp==0x7FF)&&(d.parts.mantisa==0x0)); |
|
- | 60 | }; |
|
- | 61 | ||
47 | inline int isFloat32Zero(float32 f) |
62 | inline int isFloat32Zero(float32 f) |
48 | { |
63 | { |
49 | return (((f.binary) & 0x7FFFFFFF) == 0); |
64 | return (((f.binary) & 0x7FFFFFFF) == 0); |
50 | } |
65 | } |
51 | 66 | ||
- | 67 | inline int isFloat64Zero(float64 d) |
|
- | 68 | { |
|
- | 69 | return (((d.binary) & 0x7FFFFFFFFFFFFFFFll) == 0); |
|
- | 70 | } |
|
- | 71 | ||
52 | /** |
72 | /** |
53 | * @return 1, if both floats are equal - but NaNs are not recognized |
73 | * @return 1, if both floats are equal - but NaNs are not recognized |
54 | */ |
74 | */ |
55 | inline int isFloat32eq(float32 a, float32 b) |
75 | inline int isFloat32eq(float32 a, float32 b) |
56 | { |
76 | { |
Line 98... | Line 118... | ||
98 | return (a.binary>b.binary); |
118 | return (a.binary>b.binary); |
99 | 119 | ||
100 | } |
120 | } |
101 | 121 | ||
102 | 122 | ||
- | 123 |