commit 4c2612fff30496f374ffa146a7b944582728e1ed parent f71af614f1ed2a15f176c0d649dfef5a116478c5 Author: Sebastian <sebastian@sebsite.pw> Date: Sun, 1 Dec 2024 20:25:43 -0500 math: use constants in nearbyint Signed-off-by: Sebastian <sebastian@sebsite.pw> Diffstat:
M | math/floats.ha | | | 8 | ++++---- |
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/math/floats.ha b/math/floats.ha @@ -501,8 +501,8 @@ export fn nextafterf64(x: f64, y: f64) f64 = { // Round a f32 to nearest integer value in floating point format fn nearbyintf32(x: f32) f32 = { let n = f32bits(x); - let e = n >> 23 & 0xff; - if (e >= 0x7f + 23) { + let e = (n & F32_EXPONENT_MASK) >> F32_MANTISSA_BITS; + if (e >= F32_EXPONENT_BIAS + F32_MANTISSA_BITS) { return x; }; let s = n >> 31; @@ -520,8 +520,8 @@ fn nearbyintf32(x: f32) f32 = { // Round a f64 to nearest integer value in floating point format fn nearbyintf64(x: f64) f64 = { let n = f64bits(x); - let e = n >> 52 & 0x7ff; - if (e >= 0x3ff + 52) { + let e = (n & F64_EXPONENT_MASK) >> F64_MANTISSA_BITS; + if (e >= F64_EXPONENT_BIAS + F64_MANTISSA_BITS) { return x; }; let s = n >> 63;