works for me, too:
In [9]: x = cast_int2float(0x7ff8000000000001)
In [10]: hex(cast_float2int(x))
Out[10]: '0x7ff8000000000001'
In [11]: x = cast_int2float(0x7ff0000000000001)
In [12]: hex(cast_float2int(x))
Out[12]: '0x7ff0000000000001'
OS-X, conda build:
Python 3.7.0 | packaged by conda-forge | (default, Aug 27 2018, 17:24:52)
[Clang 6.1.0 (clang-602.0.53)] on darwin
I suspect it depends on the compiler's math library
But neither is raising an exception:
In [3]: x = cast_int2float(0x7ff0000000000001)
In [4]: y = cast_int2float(0x7ff8000000000001)
In [5]: 2.0 / x
Out[5]: nan
In [6]: 2.0 / y
Out[6]: nan
When should it?
-CHB