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

Commit 02124db

Browse files
committed
Add tests against MPFR for scalbn{f} and ldexp{f}
1 parent 1b89400 commit 02124db

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
@@ -255,6 +255,34 @@ macro_rules! impl_op_for_ty {
255255
}
256256
}
257257

258+
// `ldexp` and `scalbn` are the same for binary floating point, so just forward all
259+
// methods.
260+
impl MpOp for crate::op::[<ldexp $suffix>]::Routine {
261+
type MpTy = <crate::op::[<scalbn $suffix>]::Routine as MpOp>::MpTy;
262+
263+
fn new_mp() -> Self::MpTy {
264+
<crate::op::[<scalbn $suffix>]::Routine as MpOp>::new_mp()
265+
}
266+
267+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
268+
<crate::op::[<scalbn $suffix>]::Routine as MpOp>::run(this, input)
269+
}
270+
}
271+
272+
impl MpOp for crate::op::[<scalbn $suffix>]::Routine {
273+
type MpTy = MpFloat;
274+
275+
fn new_mp() -> Self::MpTy {
276+
new_mpfloat::<Self::FTy>()
277+
}
278+
279+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
280+
this.assign(input.0);
281+
*this <<= input.1;
282+
prep_retval::<Self::FTy>(this, Ordering::Equal)
283+
}
284+
}
285+
258286
impl MpOp for crate::op::[<sincos $suffix>]::Routine {
259287
type MpTy = (MpFloat, MpFloat);
260288

crates/libm-test/tests/multiprecision.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,10 @@ libm_macros::for_each_function! {
5656
frexpf,
5757
ilogb,
5858
ilogbf,
59-
ldexp,
60-
ldexpf,
6159
modf,
6260
modff,
6361
remquo,
6462
remquof,
65-
scalbn,
66-
scalbnf,
6763

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

0 commit comments

Comments
 (0)