# HG changeset patch # User Jaroslav Hajek # Date 1271358607 -7200 # Node ID e74bff13aa26bdb96a4c572f239cfc1e4715b496 # Parent 6538ff56294975865bb7e285f9f294fa5aa73b4a improve stdnormal_cdf accuracy by using erfc (bug #29543) diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-04-15 Jaroslav Hajek + + * statistics/distributions/stdnormal_cdf.m: Calculate using erfc. + 2010-04-13 David Bateman * statistics/discrete_cdf.m: Reimplement using lookup. diff --git a/scripts/statistics/distributions/stdnormal_cdf.m b/scripts/statistics/distributions/stdnormal_cdf.m --- a/scripts/statistics/distributions/stdnormal_cdf.m +++ b/scripts/statistics/distributions/stdnormal_cdf.m @@ -37,7 +37,7 @@ error ("stdnormal_cdf: x must not be empty"); endif - cdf = (ones (sz) + erf (x / sqrt (2))) / 2; + cdf = erfc (x / (-sqrt(2))) / 2; endfunction