This updates the exponent calculations done in the nextafter functions related

to detecting underflow/overflow. The functions now match the behavior of the
MUSL implementations these were based on.

Fixes #286
This commit is contained in:
Mark S. Baranowski
2023-10-31 15:59:56 -06:00
parent 721a5edc1b
commit 837453879d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ pub fn nextafter(x: f64, y: f64) -> f64 {
ux_i += 1;
}
let e = ux_i.wrapping_shr(52 & 0x7ff);
let e = ux_i >> 52 & 0x7ff;
// raise overflow if ux.f is infinite and x is finite
if e == 0x7ff {
force_eval!(x + x);
+1 -1
View File
@@ -23,7 +23,7 @@ pub fn nextafterf(x: f32, y: f32) -> f32 {
ux_i += 1;
}
let e = ux_i.wrapping_shr(0x7f80_0000_u32);
let e = ux_i & 0x7f80_0000_u32;
// raise overflow if ux_f is infinite and x is finite
if e == 0x7f80_0000_u32 {
force_eval!(x + x);