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

Commit d05d0aa

Browse files
committed
more wrapping
1 parent 7b4b871 commit d05d0aa

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

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

+4-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub struct TestCase<Op: MathOp> {
1818
}
1919

2020
impl<Op: MathOp> TestCase<Op> {
21-
#[expect(dead_code)]
2221
fn append_inputs(v: &mut Vec<Self>, l: &[Op::RustArgs]) {
2322
v.extend(l.iter().copied().map(|input| Self { input, output: None }));
2423
}
@@ -430,18 +429,13 @@ fn frexpf_cases() -> Vec<TestCase<op::frexpf::Routine>> {
430429

431430
fn hypot_cases() -> Vec<TestCase<op::hypot::Routine>> {
432431
let mut v = vec![];
433-
TestCase::append_pairs(
432+
TestCase::append_inputs(
434433
&mut v,
435434
&[
436435
// 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-
),
436+
(hf64!("-0x1.800f800f80100p+1023"), hf64!("0x1.8354835473720p+996")),
437+
(hf64!("0x1.201b201b201c0p+0"), hf64!("0x1.b028b028b02a0p-1")),
438+
(hf64!("-0x1.e538e538e564p+980"), hf64!("-0x1.c4dfc4dfc508p+983")),
445439
],
446440
);
447441
v

src/math/hypot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ fn as_hypot_hard(x: f64, y: f64, flag: FExcept) -> f64 {
190190
cold_path();
191191
let lm2: u128 = (lm as u128) * (lm as u128);
192192
ls *= 2;
193-
m2 += (lm2 >> -ls) as u64;
193+
m2 = m2.wrapping_add((lm2 >> -ls) as u64);
194194
m2 |= ((lm2 << (128 + ls)) != 0) as u64;
195195
}
196196

0 commit comments

Comments
 (0)