Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions libm-test/src/generate/case_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub struct TestCase<Op: MathOp> {
}

impl<Op: MathOp> TestCase<Op> {
#[expect(dead_code)]
fn append_inputs(v: &mut Vec<Self>, l: &[Op::RustArgs]) {
v.extend(l.iter().copied().map(|input| Self {
input,
Expand Down Expand Up @@ -458,7 +457,27 @@ fn frexpf_cases() -> Vec<TestCase<op::frexpf::Routine>> {
}

fn hypot_cases() -> Vec<TestCase<op::hypot::Routine>> {
vec![]
let mut v = vec![];
TestCase::append_inputs(
&mut v,
&[
// Cases that can overflow exponent if wrapping arithmetic is not used
(
hf64!("-0x1.800f800f80100p+1023"),
hf64!("0x1.8354835473720p+996"),
),
(hf64!("0x1.201b201b201c0p+0"), hf64!("0x1.b028b028b02a0p-1")),
(
hf64!("-0x1.e538e538e564p+980"),
hf64!("-0x1.c4dfc4dfc508p+983"),
),
(
hf64!("-0x1.2f22e4f77aa58p+983"),
hf64!("-0x1.44c9f5524c8ccp+980"),
),
],
);
v
}

fn hypotf_cases() -> Vec<TestCase<op::hypotf::Routine>> {
Expand Down
2 changes: 2 additions & 0 deletions libm-test/src/precision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {

// Operations that aren't required to be exact, but our implementations are.
Bn::Cbrt => 0,
Bn::Hypot if ctx.fn_ident == Id::Hypot => 0,

// Bessel functions have large inaccuracies.
Bn::J0 | Bn::J1 | Bn::Y0 | Bn::Y1 | Bn::Jn | Bn::Yn => 8_000_000,
Expand Down Expand Up @@ -100,6 +101,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
Id::Cbrt => ulp = 2,
// FIXME(#401): musl has an incorrect result here.
Id::Fdim => ulp = 2,
Id::Hypot => ulp = 1,
Id::Sincosf => ulp = 500,
Id::Tgamma => ulp = 20,
_ => (),
Expand Down
1 change: 1 addition & 0 deletions libm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
)]
#![cfg_attr(f128_enabled, feature(f128))]
#![cfg_attr(f16_enabled, feature(f16))]
#![allow(internal_features)]
#![allow(clippy::assign_op_pattern)]
#![allow(clippy::deprecated_cfg_attr)]
#![allow(clippy::eq_op)]
Expand Down
Loading
Loading