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

Robert Kern robert.kern at gmail.com
Sun Jan 22 20:15:50 CST 2006

Evan Monroig wrote:
> Hi,
> I have this strange problem that the special erf function returns NANs
> when the input is an array:

> Can anyone reproduce the problem?

Yes, also on OS X, and only with the almost-but-not-quite-1.0 that you get by
adding 0.1 to 0.0 ten times.

In [9]: x = 0.0

In [10]: for i in range(10):
   ....:     x += 0.1

In [11]: x
Out[11]: 0.99999999999999989

In [12]: scipy.special.erf(x)
Out[12]: nan

It's probably a platform-specific bug in Cephes. I'll try to see if it shows up
in C, too.

Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

More information about the SciPy-user mailing list