Re:Why does 0.1 and 0.2 = 0.30000000000000004?
by Out_of_Characte on Thursday February 09, 2023 @01:11AM
(#34720330)
It would lead to some hilarious malpractise if anyone understood floating point and stole a billion cents. Things like this has happend and will continue if people arent aware of floating point error.
[ Parent
| on HN ]
Re:Why does 0.1 and 0.2 = 0.30000000000000004?
by DougBTX on Thursday February 09, 2023 @03:15AM
(#34721100)
> of floating point error.
Worth noting that this is a risk whenever there is rounding, if this chain of logic happens with cents as ints, it is still wrong:
1 / 2 => 0
0 * 2 => 0
Therefore: 1 == 0