-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-fmtArea: `core::fmt`Area: `core::fmt`C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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 :)
m-ou-se, Lynnesbian, kornelski, honnza, gliderkite and 3 more
Metadata
Metadata
Assignees
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-fmtArea: `core::fmt`Area: `core::fmt`C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.