@@ -796,8 +796,9 @@ impl f32 {
796
796
#[ unstable( feature = "float_next_up_down" , issue = "91399" ) ]
797
797
#[ rustc_const_unstable( feature = "float_next_up_down" , issue = "91399" ) ]
798
798
pub const fn next_up ( self ) -> Self {
799
- // We must use strictly integer arithmetic to prevent denormals from
800
- // flushing to zero after an arithmetic operation on some platforms.
799
+ // Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
800
+ // denormals to zero. This is in general unsound and unsupported, but here
801
+ // we do our best to still produce the correct result on such targets.
801
802
let bits = self . to_bits ( ) ;
802
803
if self . is_nan ( ) || bits == Self :: INFINITY . to_bits ( ) {
803
804
return self ;
@@ -843,8 +844,9 @@ impl f32 {
843
844
#[ unstable( feature = "float_next_up_down" , issue = "91399" ) ]
844
845
#[ rustc_const_unstable( feature = "float_next_up_down" , issue = "91399" ) ]
845
846
pub const fn next_down ( self ) -> Self {
846
- // We must use strictly integer arithmetic to prevent denormals from
847
- // flushing to zero after an arithmetic operation on some platforms.
847
+ // Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
848
+ // denormals to zero. This is in general unsound and unsupported, but here
849
+ // we do our best to still produce the correct result on such targets.
848
850
let bits = self . to_bits ( ) ;
849
851
if self . is_nan ( ) || bits == Self :: NEG_INFINITY . to_bits ( ) {
850
852
return self ;
0 commit comments