Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 7b4b871

Browse files
committed
update
1 parent 8817dee commit 7b4b871

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

crates/libm-test/src/gen/case_list.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,17 @@ fn hypot_cases() -> Vec<TestCase<op::hypot::Routine>> {
432432
let mut v = vec![];
433433
TestCase::append_pairs(
434434
&mut v,
435-
&[(
436-
// Case that can overflow exponent if wrapping arithmetic is not used
437-
(hf64!("-0x1.800f800f80100p+1023"), hf64!("0x1.8354835473720p+996")),
438-
Some(hf64!("0x1.800f800f80100p+1023")),
439-
)],
435+
&[
436+
// Cases that can overflow exponent if wrapping arithmetic is not used
437+
(
438+
(hf64!("-0x1.800f800f80100p+1023"), hf64!("0x1.8354835473720p+996")),
439+
Some(hf64!("0x1.800f800f80100p+1023")),
440+
),
441+
(
442+
(hf64!("0x1.201b201b201c0p+0"), hf64!("0x1.b028b028b02a0p-1")),
443+
Some(hf64!("0x1.6821e821e8230p+0")),
444+
),
445+
],
440446
);
441447
v
442448
}

src/math/hypot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use super::sqrt;
1818
#[allow(unused_imports)] // msrv compat
1919
use super::support::Float;
20-
use super::support::cold_path;
20+
use super::support::{Hexf, cold_path};
2121

2222
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
2323
pub fn hypot(x: f64, y: f64) -> f64 {
@@ -185,7 +185,7 @@ fn as_hypot_hard(x: f64, y: f64, flag: FExcept) -> f64 {
185185

186186
if ls >= 0 {
187187
lm <<= ls;
188-
m2 += lm.wrapping_mul(lm);
188+
m2 = m2.wrapping_add(lm.wrapping_mul(lm));
189189
} else {
190190
cold_path();
191191
let lm2: u128 = (lm as u128) * (lm as u128);

0 commit comments

Comments
 (0)