Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 )



But here rounding is giving you the wrong answer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: