@@ -594,7 +594,7 @@ impl f32 {
594594 // However, std can't simply compare to zero to check for zero, either,
595595 // as correctness requires avoiding equality tests that may be Subnormal == -0.0
596596 // because it may be wrong under "denormals are zero" and "flush to zero" modes.
597- // Most of std's targets don't use those, but they are used for thumbv7neon" .
597+ // Most of std's targets don't use those, but they are used for thumbv7neon.
598598 // So, this does use bitpattern matching for the rest.
599599
600600 // SAFETY: f32 to u32 is fine. Usually.
@@ -609,6 +609,12 @@ impl f32 {
609609 // FIXME(jubilee): This probably could at least answer things correctly for Infinity,
610610 // like the f64 version does, but I need to run more checks on how things go on x86.
611611 // I fear losing mantissa data that would have answered that differently.
612+ //
613+ // # Safety
614+ // This requires making sure you call this function for values it answers correctly on,
615+ // otherwise it returns a wrong answer. This is not important for memory safety per se,
616+ // but getting floats correct is important for not accidentally leaking const eval
617+ // runtime-deviating logic which may or may not be acceptable.
612618 #[ rustc_const_unstable( feature = "const_float_classify" , issue = "72505" ) ]
613619 const unsafe fn partial_classify ( self ) -> FpCategory {
614620 const EXP_MASK : u32 = 0x7f800000 ;
@@ -992,7 +998,7 @@ impl f32 {
992998 // ...sorta.
993999 //
9941000 // It turns out that at runtime, it is possible for a floating point number
995- // to be subject to a floating point mode that alters nonzero subnormal numbers
1001+ // to be subject to floating point modes that alter nonzero subnormal numbers
9961002 // to zero on reads and writes, aka "denormals are zero" and "flush to zero".
9971003 // This is not a problem usually, but at least one tier2 platform for Rust
9981004 // actually exhibits this behavior by default: thumbv7neon
0 commit comments