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
5 odpowiedzi
+ 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
0
show your attempt first
0
This my code MATOVU CALEB 🙏
0
Thanks Lisa 🙏