0

Round-to-even results in an odd number instead of even ?

131.505 => 131.5 131.515 => 131.51 <- wt* 131.525 => 131.52 131.535 => 131.54 131.545 => 131.54 131.555 => 131.56 131.565 => 131.56 131.575 => 131.57 <- wt* 131.585 => 131.58 131.595 => 131.6 I was expecting 131.515 => 131.52 131.575 => 131.58

3rd Sep 2022, 5:04 AM
Zulpakar
Zulpakar - avatar
5 Respostas
+ 2
Quoting from the docs: "Floating point numbers cannot represent all decimals precisely in binary. This can lead to unexpected results [...]" https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
3rd Sep 2022, 8:09 AM
Lisa
Lisa - avatar
0
show your attempt first
3rd Sep 2022, 5:14 AM
MATOVU CALEB
MATOVU CALEB - avatar
0
This my code MATOVU CALEB 🙏
3rd Sep 2022, 6:28 AM
Zulpakar
Zulpakar - avatar
0
Thanks Lisa 🙏
3rd Sep 2022, 9:14 AM
Zulpakar
Zulpakar - avatar