You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
np.log1p(inf) returns NaN while it should return inf #4225
I get the following on Windows 7 (64 bit), using Anaconda 1.7.0, which includes numpy 1.7.1 (that's all I have installed in my Windows VM at the moment):
>>> import numpy as np
>>> np.__version__
'1.7.1'
>>> np.log1p(np.inf)
__main__:1: RuntimeWarning: invalid value encountered in log1p
nan
np.log works as expected:
>>> np.log(np.inf)
inf
Also, np.expm1 gives nan when it should give inf:
>>> np.expm1(np.inf)
__main__:1: RuntimeWarning: invalid value encountered in expm1
nan
>>> np.exp(np.inf)
inf
the mingw binaries which we have on sourceforge seem ok, so its just the ms compiler builds that are broken.
while i know ms does not care about C99 as the language, do they really not care about correct math? C++ likely uses the same library.
Fixes for the non mingw buildsystem are appreciated.
Activity
WarrenWeckesser commentedon Jan 23, 2014
I get the following on Windows 7 (64 bit), using Anaconda 1.7.0, which includes numpy 1.7.1 (that's all I have installed in my Windows VM at the moment):
np.logworks as expected:Also,
np.expm1givesnanwhen it should giveinf:juliantaylor commentedon Jan 23, 2014
looks like our no-C99 fallback is not C99 compliant again, it divides inf/inf = nan
does windows really not have C99 math or are our binary builds just not correct?
juliantaylor commentedon Mar 2, 2014
the mingw binaries which we have on sourceforge seem ok, so its just the ms compiler builds that are broken.
while i know ms does not care about C99 as the language, do they really not care about correct math? C++ likely uses the same library.
Fixes for the non mingw buildsystem are appreciated.
BUG: fix non-c99 fallback for np.inf input to log1p/expm1
BUG: fix non-c99 fallback for np.inf input to log1p/expm1