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

James Anderson james.anderson at icr.ac.uk
Thu Nov 30 08:42:20 CST 2006

On Jan 23, 2006, at 04:32, David M. Cooke wrote:
> 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.

I dug this out of the archives from January '06;  I'm still getting  
the same behaviour with python 2.4.3, compiled to Mac OS 10.4.5 with  
gcc 4.0.1 using scipy 0.5.2.dev2095.  I came at it a different way  
and first discovered that erf(48.0083465504) gives nan.  I'm going to  
tackle David Cooke's suggestion above and was wondering which file  
the "#define erf cephes_erf" header ought to go in?

Also, if anyone knows the current status of this issue, I'd  
appreciate hearing about that, too.


More information about the SciPy-user mailing list