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
This commit is contained in:
committed by
Trevor Gross
parent
59964fbbca
commit
e9bc33e8d3
@@ -258,6 +258,25 @@ macro_rules! impl_op_for_ty {
|
||||
}
|
||||
}
|
||||
|
||||
impl MpOp for crate::op::[<frexp $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 {
|
||||
// Implementation taken from `rug::Float::to_f32_exp`.
|
||||
this.assign(input.0);
|
||||
let exp = this.get_exp().unwrap_or(0);
|
||||
if exp != 0 {
|
||||
*this >>= exp;
|
||||
}
|
||||
|
||||
(prep_retval::<Self::FTy>(this, Ordering::Equal), exp)
|
||||
}
|
||||
}
|
||||
|
||||
impl MpOp for crate::op::[<jn $suffix>]::Routine {
|
||||
type MpTy = MpFloat;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user