| author | |
| committer | |
| log | 850f6d2d0266c0b502f0f0aa39ae32de469d03d9 |
| tree | 54b242d01b593ef81dfab78f5c2cef04c63b3a86 |
| parent | 90a32629c0120acba881c87e84b7291732703fbe |
1 files changed, 5 insertions(+), 1 deletions(-)
std/math.zig+5-1| ... | ... | @@ -17,7 +17,11 @@ pub fn f64_get_neg_inf() -> f64 { |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 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 | 27 | pub fn f64_is_inf(f: f64) -> bool { |