I've got the following Python script:
x = 300000000.0
while (x < x + x):
x = x + x
print "exec: " + str(x)
print "terminated" + str(x)
This seemingly infinite loop, terminates pretty quickly if x is a floating point number. But if i change x to 300000000 instead, it gets into an infinite loop (runs longer than a minute in my test).
I think this is to do with the fact that it's exhausting the precision of a floating point number that can be represented in memory. Can someone provide a more detailed explanation why this is?