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

Commit 9b15f00

Browse files
committed
Add tests against MPFR for frexp and frexpf
This implementation comes from `rug::Float::to_f32_exp` [1]. [1]: https://docs.rs/rug/1.26.1/rug/struct.Float.html#method.to_f32_exp
1 parent cc29de2 commit 9b15f00

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

crates/libm-test/src/mpfloat.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,25 @@ macro_rules! impl_op_for_ty {
258258
}
259259
}
260260

261+
impl MpOp for crate::op::[<frexp $suffix>]::Routine {
262+
type MpTy = MpFloat;
263+
264+
fn new_mp() -> Self::MpTy {
265+
new_mpfloat::<Self::FTy>()
266+
}
267+
268+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
269+
// Implementation taken from `rug::Float::to_f32_exp`.
270+
this.assign(input.0);
271+
let exp = this.get_exp().unwrap_or(0);
272+
if exp != 0 {
273+
*this >>= exp;
274+
}
275+
276+
(prep_retval::<Self::FTy>(this, Ordering::Equal), exp)
277+
}
278+
}
279+
261280
impl MpOp for crate::op::[<jn $suffix>]::Routine {
262281
type MpTy = MpFloat;
263282

crates/libm-test/tests/multiprecision.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ libm_macros::for_each_function! {
5252
],
5353
skip: [
5454
// FIXME: MPFR tests needed
55-
frexp,
56-
frexpf,
5755
ilogb,
5856
ilogbf,
5957
ldexp,
@@ -159,8 +157,6 @@ libm_macros::for_each_function! {
159157
ynf,
160158

161159
// FIXME: MPFR tests needed
162-
frexp,
163-
frexpf,
164160
ilogb,
165161
ilogbf,
166162
],

0 commit comments

Comments
 (0)