improve stdnormal_cdf accuracy by using erfc (bug #29543)
author |
Jaroslav Hajek <highegg@gmail.com> |
date |
Thu, 15 Apr 2010 21:10:07 +0200 |
parents |
6538ff562949 |
children |
1c6ff93c025a |
files |
scripts/ChangeLog scripts/statistics/distributions/stdnormal_cdf.m |
diffstat |
2 files changed, 5 insertions(+), 1 deletions(-)
[+]
|
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-15 Jaroslav Hajek <highegg@gmail.com>
+
+ * statistics/distributions/stdnormal_cdf.m: Calculate using erfc.
+
2010-04-13 David Bateman <dbateman@free.fr>
* statistics/discrete_cdf.m: Reimplement using lookup.
--- 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