0

math.ceil(122.0000000000000001) showing 122 while math.ceil(122.00000001) showing 123

There is a limit in math.ceil and why is that for.

  • Your first number can't be represented as a double precision float, so it is not what you expect. There are tons of questions about this if you care to search – JBernardo Nov 20 '17 at 13:21

1 Answers1

1

The problem occurs before math.ceil is called:

>>> 122.0000000000000001
122.0
>>> 122.00000001
122.00000001
Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680