9,999,999,999,999,978 and 1 – 2 incorrect on iOS Calculator

2 points by windows2020 ↗ HN
A few observations (landscape mode only): * The above results in 9,999,999,999,999,978. * Add 1 a bunch of times and subtract 2 once to reach the same number. * Add 1 a bunch of times and subtract 1 a bunch of times and the answer is still displayed in scientific notation, until 2 is subtracted, at which point the above number is displayed.

5 comments

[ 2.9 ms ] story [ 23.7 ms ] thread
You should read this:

What Every Computer Scientist Should Know About Floating-Point Arithmetic

https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.h...

(comment deleted)