4 ms·
You can get a larger error than that using one operation. fn main() { let x: f64 = 9007199254740992.0; assert_eq!(x + 1.0, x); }
by umanwizard 7y ago
You can get a larger error than that using one operation.
fn main() {
let x: f64 = 9007199254740992.0;
assert_eq!(x + 1.0, x);
}
- piadodjanho 7y agoYou are absolutely right. When adding numbers with large magnitudes differences (around 10^17 I think) it might exceed the format precision. I should have taken that in account when defining the error boundaries. In dollars, you start having issues with cents when working with a tens of trillions. For the vast majority of people this won't be an issue.
- deleted 7y ago[deleted]