Test-case:
fn main() {
let f = 2147483648.0f32;
println!("{} | {}", f, f as f64)
}
I expected both to produce the same number, since that number is a perfectly representable f32 value.
This bit me because I was investigating an issue where values close to integer limits were treated as negative.
Seeing 2147483600 (in range for an i32) rather than the actual value 2147483648 (out of range for an i32) made it all really confusing.
Anyhow, I'll fix Firefox to do the proper bounds check, but it would've been nice to avoid the extra confusion time :)
Test-case:
I expected both to produce the same number, since that number is a perfectly representable
f32value.This bit me because I was investigating an issue where values close to integer limits were treated as negative.
Seeing
2147483600(in range for an i32) rather than the actual value2147483648(out of range for ani32) made it all really confusing.Anyhow, I'll fix Firefox to do the proper bounds check, but it would've been nice to avoid the extra confusion time :)