5 ms·
If point 1 is true then why is 0.1 + 0.2 = 30000000000000004? Is that not close enough to zero? Edit: It seems I’m conflating “precision” with “accuracy”, whic
by CSSer 4y ago
If point 1 is true then why is 0.1 + 0.2 = 30000000000000004? Is that not close enough to zero?
Edit: It seems I’m conflating “precision” with “accuracy”, which is a separate concept in math.
- throwawaymaths 4y agoThis is a problem for all number systems. The true issue here is not a precision in the underlying bit representation of IEEE-754, it's that 0.1 and 0.2 aren't actually a valid IEEE-754 numbers, and so they get casted to their best approximations.
- jcranmer 4y agoThat result happens for the same reason that 1 / 3 * 3 != 1, if you use decimal: 1 / 3 = .333, .333 * 3 = .999, which is different from 1.00. 0.1 is the same as 1 / 10, which does not have a finite representation in binary notation, just as 1 / 3 does not have a finite representation in binary or decimal notation.