[SciPy-user] scipy.special.erf randomly returns NANs on OSX

David M. Cooke cookedm at physics.mcmaster.ca
Sun Jan 22 21:32:07 CST 2006

Robert Kern <robert.kern at gmail.com> writes:

> Evan Monroig wrote:
>> Hi,
>> I have this strange problem that the special erf function returns NANs
>> when the input is an array:
>> scipy is, numpy is, I am running on Mac OS X
>> with MacPython 2.4.1
>> Can anyone reproduce the problem?
> Actually, on OS X, /usr/include/math.h defines an erf() function that is
> probably getting picked up instead of Cephes's version. Bad Apple!

Hmm, we've seen this type of problem before, with round(). Cephes
really should use a namespace (cephes_erf() instead of plain erf(),
for instance).

The least-intrusive patch would be a header with things like
#define erf cephes_erf
then when linking the cephes version will be pulled in.

I've also just noticed that we're using an older version of Cephes
(release 2.3, Jan. 1995) compared with one on netlib (release 2.9, Nov. 2000).

I'll have a look at making a header, and then updating to the latest.

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the SciPy-user mailing list