[Numpy-tickets] [NumPy] #959: atanh(+1) gives nan instead of inf on Windows
NumPy
numpy-tickets@scipy....
Wed Nov 26 04:32:45 CST 2008
#959: atanh(+1) gives nan instead of inf on Windows
------------------------+---------------------------------------------------
Reporter: faltet | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 1.3.0
Component: numpy.core | Version: devel
Severity: normal | Resolution:
Keywords: |
------------------------+---------------------------------------------------
Comment (by faltet):
I've been looking at this issue. When replacing the current definition on
umath_funcs_c99.inc.src:
{{{
static double
npy_atanh(double x)
{
return 0.5*log1p(2.0*x/(1.0-x));
}
}}}
by this one (found in
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/atanh.html):
{{{
static double
npy_atanh(double x)
{
return 0.5*log((1.0+x)/(1.0-x));
}
}}}
the arctanh function behaves as it should on Win:
{{{
>>> import numpy
>>> numpy.__version__
'1.3.0.dev6109'
>>> numpy.arctanh(1.)
inf
>>> numpy.arctanh(-1.)
-inf
}}}
I think the latter defintion of atanh() (i.e. à la !MatLab) was in !NumPy
before, but not sure when it changed to the current definition (based in
log1p()). I'd propose to revert the change (although I'm curious about
the rational behind it).
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/959#comment:1>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list