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

Commit 9db86f4

Browse files
committed
more wrapping
1 parent e658cf1 commit 9db86f4

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ fn hypot_cases() -> Vec<TestCase<op::hypot::Routine>> {
436436
(hf64!("-0x1.800f800f80100p+1023"), hf64!("0x1.8354835473720p+996")),
437437
(hf64!("0x1.201b201b201c0p+0"), hf64!("0x1.b028b028b02a0p-1")),
438438
(hf64!("-0x1.e538e538e564p+980"), hf64!("-0x1.c4dfc4dfc508p+983")),
439+
(hf64!("-0x1.2f22e4f77aa58p+983"), hf64!("-0x1.44c9f5524c8ccp+980")),
439440
],
440441
);
441442
v

crates/libm-test/src/run_cfg.rs

+18-14
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,6 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
200200
domain_iter_count = 100_000;
201201
}
202202

203-
// Larger float types get more iterations.
204-
if t_env.large_float_ty {
205-
domain_iter_count *= 4;
206-
}
207-
208-
// Functions with more arguments get more iterations.
209-
let arg_multiplier = 1 << (t_env.input_count - 1);
210-
domain_iter_count *= arg_multiplier;
211-
212203
// If we will be running tests against MPFR, we don't need to test as much against musl.
213204
// However, there are some platforms where we have to test against musl since MPFR can't be
214205
// built.
@@ -228,6 +219,24 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
228219
}
229220
};
230221

222+
// Larger float types get more iterations.
223+
if t_env.large_float_ty && ctx.gen_kind != GeneratorKind::Extensive {
224+
if ctx.gen_kind == GeneratorKind::Extensive {
225+
total_iterations *= 2;
226+
} else {
227+
total_iterations *= 4;
228+
}
229+
}
230+
231+
// Functions with more arguments get more iterations.
232+
let arg_multiplier = 1 << (t_env.input_count - 1);
233+
total_iterations *= arg_multiplier;
234+
235+
// FMA has a huge domain but is reasonably fast to run, so increase iterations.
236+
if ctx.base_name == BaseName::Fma {
237+
total_iterations *= 4;
238+
}
239+
231240
// Some tests are significantly slower than others and need to be further reduced.
232241
if let Some((_id, _gen, scale)) = EXTEMELY_SLOW_TESTS
233242
.iter()
@@ -239,11 +248,6 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
239248
}
240249
}
241250

242-
// FMA has a huge domain but is reasonably fast to run, so increase iterations.
243-
if ctx.base_name == BaseName::Fma {
244-
total_iterations *= 4;
245-
}
246-
247251
if cfg!(optimizations_enabled) {
248252
// Always run at least 10,000 tests.
249253
total_iterations = total_iterations.max(10_000);

src/math/hypot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn cr_hypot(mut x: f64, mut y: f64) -> f64 {
119119
ey = tld;
120120
ex &= 0x7ff_u64 << 52;
121121
let aidr: u64 = ey.wrapping_add(0x3fe_u64 << 52).wrapping_sub(ex);
122-
let mid: u64 = (aidr.wrapping_sub(0x3c90000000000000) + 16) >> 5;
122+
let mid: u64 = (aidr.wrapping_sub(0x3c90000000000000).wrapping_add(16)) >> 5;
123123
if mid == 0 || !(0x39b0000000000000_u64..=0x3c9fffffffffff80_u64).contains(&aidr) {
124124
cold_path();
125125
thd = as_hypot_hard(x, y, flag).to_bits();

0 commit comments

Comments
 (0)