| ... | @@ -17,7 +17,11 @@ pub fn f64_get_neg_inf() -> f64 { | ... | @@ -17,7 +17,11 @@ pub fn f64_get_neg_inf() -> f64 { |
| 17 | } | 17 | } |
| 18 | | 18 | |
| 19 | pub fn f64_is_nan(f: f64) -> bool { | 19 | pub fn f64_is_nan(f: f64) -> bool { |
| 20 | 0x7FFFFFFFFFFFFFFF == f64_to_bits(f) // TODO improve to catch all cases | 20 | const bits = f64_to_bits(f); |
| | 21 | const exp: i64 = i64((bits >> 52) & ((1 << 11) - 1)); |
| | 22 | const sig = (bits & ((1 << 52) - 1)) | (1 << 52); |
| | 23 | |
| | 24 | sig != 0 && exp == (1 << 11) - 1 |
| 21 | } | 25 | } |
| 22 | | 26 | |
| 23 | pub fn f64_is_inf(f: f64) -> bool { | 27 | pub fn f64_is_inf(f: f64) -> bool { |