check if object is number
Steven Bethard
steven.bethard at gmail.com
Wed Feb 16 12:36:00 EST 2005
Fredrik Lundh wrote:
> Steven Bethard wrote:
>
>>>Actually no, floats don't meet this behaviour or more specifically
>>>floats don't guarantee this behaviour. It depends of course on
>>>your implementation of f, but it is possible with floats to keep
>>>incrementing and never reach a maximum.
>>
>>My code won't hit this corner case. I'm incrementing with integers.
>
>
> incrementing what with integers?
>
> >>> f = 9007199254740992.0
> >>> f == f+1
> True
I mean that the number that's being incremented is an integer:
py> f = 9007199254740992.0
py> i = 9007199254740991
py> i <= f
True
py> i += 1
py> i <= f
True
py> i += 1
py> i <= f
False
Steve
More information about the Python-list
mailing list