@@ -524,15 +524,6 @@ impl f32 {
524
524
self != self
525
525
}
526
526
527
- // FIXME(#50145): `abs` is publicly unavailable in core due to
528
- // concerns about portability, so this implementation is for
529
- // private use internally.
530
- #[ inline]
531
- pub ( crate ) const fn abs_private ( self ) -> f32 {
532
- // SAFETY: This transmutation is fine just like in `to_bits`/`from_bits`.
533
- unsafe { mem:: transmute :: < u32 , f32 > ( mem:: transmute :: < f32 , u32 > ( self ) & !Self :: SIGN_MASK ) }
534
- }
535
-
536
527
/// Returns `true` if this value is positive infinity or negative infinity, and
537
528
/// `false` otherwise.
538
529
///
@@ -577,10 +568,11 @@ impl f32 {
577
568
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
578
569
#[ rustc_const_stable( feature = "const_float_classify" , since = "1.83.0" ) ]
579
570
#[ inline]
571
+ #[ rustc_allow_const_fn_unstable( const_float_methods) ] // for `abs`
580
572
pub const fn is_finite ( self ) -> bool {
581
573
// There's no need to handle NaN separately: if self is NaN,
582
574
// the comparison is not true, exactly as desired.
583
- self . abs_private ( ) < Self :: INFINITY
575
+ self . abs ( ) < Self :: INFINITY
584
576
}
585
577
586
578
/// Returns `true` if the number is [subnormal].
@@ -1020,8 +1012,8 @@ impl f32 {
1020
1012
const HI : f32 = f32 :: MAX / 2. ;
1021
1013
1022
1014
let ( a, b) = ( self , other) ;
1023
- let abs_a = a. abs_private ( ) ;
1024
- let abs_b = b. abs_private ( ) ;
1015
+ let abs_a = a. abs ( ) ;
1016
+ let abs_b = b. abs ( ) ;
1025
1017
1026
1018
if abs_a <= HI && abs_b <= HI {
1027
1019
// Overflow is impossible
0 commit comments