Rev 647 | Rev 653 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 647 | Rev 652 | ||
|---|---|---|---|
| Line 37... | Line 37... | ||
| 37 | inline int isFloat32SigNaN(float32 f) |
37 | inline int isFloat32SigNaN(float32 f) |
| 38 | { /* SigNaN : exp = 0xff mantisa = 1xxxxx..x (binary), where at least one x is nonzero */ |
38 | { /* SigNaN : exp = 0xff mantisa = 1xxxxx..x (binary), where at least one x is nonzero */ |
| 39 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa>0x400000)); |
39 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa>0x400000)); |
| 40 | }; |
40 | }; |
| 41 | 41 | ||
| - | 42 | inline int isFloat32Infinity(float32 f) |
|
| - | 43 | { |
|
| - | 44 | return ((f.parts.exp==0xFF)&&(f.parts.mantisa==0x0)); |
|
| - | 45 | }; |
|
| - | 46 | ||
| - | 47 | /** |
|
| - | 48 | * @return 1, if both floats are equal - but NaNs are not recognized |
|
| - | 49 | */ |
|
| - | 50 | inline int isFloat32eq(float32 a, float32 b) |
|
| - | 51 | { |
|
| - | 52 | return ((a==b)||(((a.binary| b.binary)&0x7FFFFFFF)==0)); /* a equals to b or both are zeros (with any sign) */ |
|
| - | 53 | } |
|
| - | 54 | ||
| - | 55 | /** |
|
| - | 56 | * @return 1, if a>b - but NaNs are not recognized |
|
| - | 57 | */ |
|
| - | 58 | inline int isFloat32lt(float32 a, float32 b) |
|
| - | 59 | { |
|
| - | 60 | if (((a.binary| b.binary)&0x7FFFFFFF)==0) { |
|
| - | 61 | return 0; |
|
| - | 62 | }; |
|
| - | 63 | a.parts.sign^=a.parts.sign; |
|
| - | 64 | b.parts.sign^=b.parts.sign; |
|
| - | 65 | return (a.binary<b.binary); |
|
| - | 66 | ||
| - | 67 | } |
|
| - | 68 | ||
| - | 69 | ||