[Python-Dev] Comparing heterogeneous types

Jeff Epler jepler at unpythonic.net
Wed Jun 2 18:32:45 EDT 2004

Oh -- there are some floats f for which
raises an OverflowError in float()?

My code assumed that wouldn't happen, that all longs that caused
OverflowError() in conversion to float were bigger than all finite
floats.  Surely this is just as much a problem as the overflow on

You can tell if a float f is well above Andrew's crossover value (but
still well below the largest finite value, in sane FP formats) when
    f + 1 == f
though I guess this wouldn't actually work in all rounding modes and for
all signs of f...

Just hard-code the value 53 (as in 2**53).  But write it as 42 +
sizeof(double) + sizeof(int) - 1 and put a cryptic comment next to it.
I suggest
    /* on 36-bit platforms, this may be wrog */

It's clear that I should think this through some more before making any
more suggestions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20040602/e8ec0be5/attachment-0001.bin

More information about the Python-Dev mailing list