-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Change in longdouble calculations in numpy >= 1.12 on OSX #8608
Copy link
Copy link
Closed
Description
For numpy 1.11.3:
In [1]: import numpy as np
In [2]: np.__version__
Out[2]: '1.11.3'
In [3]: np.float128(2) ** 16383
Out[3]: 5.9486574767861588254e+4931
This is correct, as 16383 is the maximum exponent value for the float-80 longdouble on OSX.
For numpy 1.12 and curent master:
In [1]: import numpy as np
In [2]: np.__version__
Out[2]: '1.13.0.dev0+a9d6941'
In [3]: np.float128(2) ** 16383
/Users/mb312/.virtualenvs/test3/bin/ipython:1: RuntimeWarning: overflow encountered in longdouble_scalars
#!/Users/mb312/.virtualenvs/test3/bin/python3.5
Out[3]: inf
In fact, numpy >= 1.12 seems to be using float64 for this calculation:
In [13]: np.float128(2) ** 1024
/Users/mb312/.virtualenvs/test3/bin/ipython:1: RuntimeWarning: overflow encountered in longdouble_scalars
#!/Users/mb312/.virtualenvs/test3/bin/python3.5
Out[13]: inf
In [14]: np.float128(2) ** 1023
Out[14]: 8.9884656743115795386e+307
Reactions are currently unavailable