[SciPy-user] nan bug in distributions.norm.cdf

Robert Kern robert.kern@gmail....
Thu Feb 22 11:15:29 CST 2007

Christopher Fonnesbeck wrote:
> For some reason, perfectly valid normal random variates return a nan
> when passed to the normal cdf in the stats.distributions package:
> In [10]: from scipy.stats import distributions as d
> ...
> In [31]: d.norm.cdf(-0.73646593092)
> Out[31]: array(nan)
> In [32]: d.norm.cdf(-0.7)
> Out[32]: array(0.24196365222307303 )
> In [33]: d.norm.cdf(-0.8)
> Out[33]: array(0.21185539858339669)
> Simply rounding this value makes it work. Not sure why this happens.
> Using a relatively recent svn build on OSX.

Current SVN on Intel OS X:

Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import stats
>>> stats.norm.cdf(-0.73646593092)

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the SciPy-user mailing list