Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is sys.maxint < (sys.maxint - 100 + 0.01) in Python?

Why is sys.maxint < (sys.maxint - 100 + 0.01) in Python?

like image 489
satoru Avatar asked Mar 25 '11 07:03

satoru


1 Answers

This is probably due to loss of precision for very large floating point values. (the adding of 0.01 converts the right-hand-side to float).

Edit: I have tried to come up with an exact explanation of what happens here, but to no avail. So I posted a question about it.

like image 115
Björn Pollex Avatar answered Oct 09 '22 22:10

Björn Pollex