3 ms·
Parsing the provided numbers to two IEEE 754 double-precision floats, and then subtracting them, yields 2.0 (due to rounding) In particular, 9999999999999999.0
by Retr0id 3y ago
Parsing the provided numbers to two IEEE 754 double-precision floats, and then subtracting them, yields 2.0 (due to rounding)
In particular, 9999999999999999.0 rounds up to 10000000000000000.0
(note, this behavior depends on the rounding mode, https://en.wikipedia.org/wiki/IEEE_754#Rounding_rules https://en.wikipedia.org/wiki/IEEE_754#Rounding_rules )
- GTP 3y agoBut here rounding is giving you the wrong answer.