Closed
Description
Noticed this while playing with #54235.
fn f(x: f64) -> f64 {
0f64 / x
}
fn main() {
println!("{:?}", (0f64 / 0f64).is_sign_negative());
println!("{:?}", f(0f64).is_sign_negative());
}
As of rustc 1.31.0-nightly (46880f4 2018-10-15) on x86_64-unknown-linux-gnu, in debug mode this program prints false
true
and in release mode prints false
false
. Two of my expectations are violated:
- The output should be consistent between debug mode and release mode.
- The first and second println should print the same value.
(Happy to reconsider if these expectations are unfounded.)