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

Commit cc29de2

Browse files
committed
Add tests against MPFR for modf and modff
Rug provides `trunc_fract_round`, which implements `modf`, use it to add a test.
1 parent aa3d242 commit cc29de2

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

crates/libm-test/src/mpfloat.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,24 @@ macro_rules! impl_op_for_ty {
210210
}
211211
}
212212

213+
impl MpOp for crate::op::[<modf $suffix>]::Routine {
214+
type MpTy = (MpFloat, MpFloat);
215+
216+
fn new_mp() -> Self::MpTy {
217+
(new_mpfloat::<Self::FTy>(), new_mpfloat::<Self::FTy>())
218+
}
219+
220+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
221+
this.0.assign(input.0);
222+
this.1.assign(&this.0);
223+
let (ord0, ord1) = this.0.trunc_fract_round(&mut this.1, Nearest);
224+
(
225+
prep_retval::<Self::FTy>(&mut this.1, ord0),
226+
prep_retval::<Self::FTy>(&mut this.0, ord1),
227+
)
228+
}
229+
}
230+
213231
impl MpOp for crate::op::[<pow $suffix>]::Routine {
214232
type MpTy = (MpFloat, MpFloat);
215233

crates/libm-test/tests/multiprecision.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ libm_macros::for_each_function! {
5858
ilogbf,
5959
ldexp,
6060
ldexpf,
61-
modf,
62-
modff,
6361
remquo,
6462
remquof,
6563
scalbn,
@@ -165,7 +163,5 @@ libm_macros::for_each_function! {
165163
frexpf,
166164
ilogb,
167165
ilogbf,
168-
modf,
169-
modff,
170166
],
171167
}

0 commit comments

Comments
 (0)