Skip to content

Commit 8d6f6a1

Browse files
committed
Add tests against MPFR for scalbn{f} and ldexp{f}
1 parent 9b15f00 commit 8d6f6a1

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

crates/libm-test/src/mpfloat.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,34 @@ macro_rules! impl_op_for_ty {
292292
}
293293
}
294294

295+
// `ldexp` and `scalbn` are the same for binary floating point, so just forward all
296+
// methods.
297+
impl MpOp for crate::op::[<ldexp $suffix>]::Routine {
298+
type MpTy = <crate::op::[<scalbn $suffix>]::Routine as MpOp>::MpTy;
299+
300+
fn new_mp() -> Self::MpTy {
301+
<crate::op::[<scalbn $suffix>]::Routine as MpOp>::new_mp()
302+
}
303+
304+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
305+
<crate::op::[<scalbn $suffix>]::Routine as MpOp>::run(this, input)
306+
}
307+
}
308+
309+
impl MpOp for crate::op::[<scalbn $suffix>]::Routine {
310+
type MpTy = MpFloat;
311+
312+
fn new_mp() -> Self::MpTy {
313+
new_mpfloat::<Self::FTy>()
314+
}
315+
316+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
317+
this.assign(input.0);
318+
*this <<= input.1;
319+
prep_retval::<Self::FTy>(this, Ordering::Equal)
320+
}
321+
}
322+
295323
impl MpOp for crate::op::[<sincos $suffix>]::Routine {
296324
type MpTy = (MpFloat, MpFloat);
297325

crates/libm-test/tests/multiprecision.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,8 @@ libm_macros::for_each_function! {
5454
// FIXME: MPFR tests needed
5555
ilogb,
5656
ilogbf,
57-
ldexp,
58-
ldexpf,
5957
remquo,
6058
remquof,
61-
scalbn,
62-
scalbnf,
6359

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

0 commit comments

Comments
 (0)