@@ -153,8 +153,12 @@ libm_macros::for_each_function! {
153153 fmodf16,
154154 frexp,
155155 frexpf,
156+ frexpf128,
157+ frexpf16,
156158 ilogb,
157159 ilogbf,
160+ ilogbf128,
161+ ilogbf16,
158162 jn,
159163 jnf,
160164 ldexp,
@@ -299,43 +303,6 @@ macro_rules! impl_op_for_ty {
299303 }
300304 }
301305
302- impl MpOp for crate :: op:: [ <frexp $suffix>] :: Routine {
303- type MpTy = MpFloat ;
304-
305- fn new_mp( ) -> Self :: MpTy {
306- new_mpfloat:: <Self :: FTy >( )
307- }
308-
309- fn run( this: & mut Self :: MpTy , input: Self :: RustArgs ) -> Self :: RustRet {
310- this. assign( input. 0 ) ;
311- let exp = this. frexp_mut( ) ;
312- ( prep_retval:: <Self :: FTy >( this, Ordering :: Equal ) , exp)
313- }
314- }
315-
316- impl MpOp for crate :: op:: [ <ilogb $suffix>] :: Routine {
317- type MpTy = MpFloat ;
318-
319- fn new_mp( ) -> Self :: MpTy {
320- new_mpfloat:: <Self :: FTy >( )
321- }
322-
323- fn run( this: & mut Self :: MpTy , input: Self :: RustArgs ) -> Self :: RustRet {
324- this. assign( input. 0 ) ;
325-
326- // `get_exp` follows `frexp` for `0.5 <= |m| < 1.0`. Adjust the exponent by
327- // one to scale the significand to `1.0 <= |m| < 2.0`.
328- this. get_exp( ) . map( |v| v - 1 ) . unwrap_or_else( || {
329- if this. is_infinite( ) {
330- i32 :: MAX
331- } else {
332- // Zero or NaN
333- i32 :: MIN
334- }
335- } )
336- }
337- }
338-
339306 impl MpOp for crate :: op:: [ <jn $suffix>] :: Routine {
340307 type MpTy = MpFloat ;
341308
@@ -466,6 +433,48 @@ macro_rules! impl_op_for_ty_all {
466433 prep_retval:: <Self :: RustRet >( & mut this. 0 , ord)
467434 }
468435 }
436+
437+ impl MpOp for crate :: op:: [ <frexp $suffix>] :: Routine {
438+ type MpTy = MpFloat ;
439+
440+ fn new_mp( ) -> Self :: MpTy {
441+ new_mpfloat:: <Self :: FTy >( )
442+ }
443+
444+ fn run( this: & mut Self :: MpTy , input: Self :: RustArgs ) -> Self :: RustRet {
445+ // Implementation taken from `rug::Float::to_f32_exp`.
446+ this. assign( input. 0 ) ;
447+ let exp = this. get_exp( ) . unwrap_or( 0 ) ;
448+ if exp != 0 {
449+ * this >>= exp;
450+ }
451+
452+ ( prep_retval:: <Self :: FTy >( this, Ordering :: Equal ) , exp)
453+ }
454+ }
455+
456+ impl MpOp for crate :: op:: [ <ilogb $suffix>] :: Routine {
457+ type MpTy = MpFloat ;
458+
459+ fn new_mp( ) -> Self :: MpTy {
460+ new_mpfloat:: <Self :: FTy >( )
461+ }
462+
463+ fn run( this: & mut Self :: MpTy , input: Self :: RustArgs ) -> Self :: RustRet {
464+ this. assign( input. 0 ) ;
465+
466+ // `get_exp` follows `frexp` for `0.5 <= |m| < 1.0`. Adjust the exponent by
467+ // one to scale the significand to `1.0 <= |m| < 2.0`.
468+ this. get_exp( ) . map( |v| v - 1 ) . unwrap_or_else( || {
469+ if this. is_infinite( ) {
470+ i32 :: MAX
471+ } else {
472+ // Zero or NaN
473+ i32 :: MIN
474+ }
475+ } )
476+ }
477+ }
469478 }
470479 } ;
471480}
0 commit comments