0

Python modulus result is incorrect:

363.12 % 7.12
  7.119999999999999

The result should be 0. Why is this?

1 Answers1

0

"Unfortunately, most decimal fractions cannot be represented exactly as binary fractions. A consequence is that, in general, the decimal floating-point numbers you enter are only approximated by the binary floating-point numbers actually stored in the machine."

by Python Docs: Floating Point Arithmetic: Issues and Limitations

gkhaos
  • 694
  • 9
  • 20