0

When I do this in python 3.9

4554.2/1000 I get the result 4.5542

However when I do

4554.3/1000 I get 4.5543000000000005

Why is that? How to not lose the precision for such small numbers?

  • 1
    Because of numbers that cannot be accurately represented by a floating-point number. Try this: https://stackoverflow.com/questions/40808511/doing-accurate-floating-point-division-in-python-3 -- does this help? – aydee45 Aug 18 '21 at 10:45

0 Answers0