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

This commit is contained in:
Trevor Gross
2025-01-03 05:28:39 +00:00
committed by Trevor Gross
parent e9bc33e8d3
commit 4b15d9e5e3
2 changed files with 28 additions and 4 deletions

View File

@@ -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);

View File

@@ -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