f64 NaN conversion to f32 maintains sign in Debug, not in Release #120898
Labels
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
T-opsem
Relevant to the opsem team
I tried this code:
https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=ca495022488c872fb3addd969e8d705e
I expected to see this happen:
f64
tof32
conversion of a NaN value has the same behavior between Debug and Release mode. Hardware may or may not be preserving sign of NaN casts, so this may differ on different hardware with different standards support, but same behavior between compile modes would be expectedInstead, this happened:
Casting a negative-signed NaN
f64
to af32
maintains the negative-sign in Debug mode but not in Release mode. This behavior has been occurring since 1.75 according to starkat99/half-rs#103 and still exists in nightly. Interestingly, when using miri, the float sign changes in both debug & release, but for positive-signed floats.Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: