0

Why is 100./3. = 33.333333333333336 and NOT 33.333333333333333 OR 33.333333333333334 ?

>>> a = 100./3.
>>> a
33.333333333333336
>>> b = a + a + a
>>> b
100.0
Parag Meshram
  • 8,281
  • 10
  • 52
  • 88

1 Answers1

0

the wrong digit at the end is because of imprecision in representing the decimal as binary data in the interpreter; the interpreter is usually good at correcting those wrong-digits

Zae Zoxol
  • 109
  • 6