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

Add tests against MPFR for scalbn{f} and ldexp{f} #392

Merged
merged 1 commit into from
Jan 5, 2025
Merged
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
28 changes: 28 additions & 0 deletions crates/libm-test/src/mpfloat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,34 @@ macro_rules! impl_op_for_ty {
}
}

// `ldexp` and `scalbn` are the same for binary floating point, so just forward all
// methods.
impl MpOp for crate::op::[<ldexp $suffix>]::Routine {
type MpTy = <crate::op::[<scalbn $suffix>]::Routine as MpOp>::MpTy;

fn new_mp() -> Self::MpTy {
<crate::op::[<scalbn $suffix>]::Routine as MpOp>::new_mp()
}

fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
<crate::op::[<scalbn $suffix>]::Routine as MpOp>::run(this, input)
}
}

impl MpOp for crate::op::[<scalbn $suffix>]::Routine {
type MpTy = MpFloat;

fn new_mp() -> Self::MpTy {
new_mpfloat::<Self::FTy>()
}

fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
this.assign(input.0);
*this <<= input.1;
prep_retval::<Self::FTy>(this, Ordering::Equal)
}
}

impl MpOp for crate::op::[<sincos $suffix>]::Routine {
type MpTy = (MpFloat, MpFloat);

Expand Down
4 changes: 0 additions & 4 deletions crates/libm-test/tests/multiprecision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@ libm_macros::for_each_function! {
// FIXME: MPFR tests needed
ilogb,
ilogbf,
ldexp,
ldexpf,
remquo,
remquof,
scalbn,
scalbnf,

// FIXME: test needed, see
// https://github.com/rust-lang/libm/pull/311#discussion_r1818273392
Expand Down