summaryrefslogtreecommitdiffstats
path: root/Lib/statistics.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-03-14 09:25:26 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-03-14 09:25:26 (GMT)
commit41f0b78cbf204649bbae71662a115425c58f048d (patch)
tree5d8c44ce22351b41e774d99c4e7c9b15f3be06d3 /Lib/statistics.py
parent3191391515824fa7f3c573d807f1034c6a28fab3 (diff)
downloadcpython-41f0b78cbf204649bbae71662a115425c58f048d.zip
cpython-41f0b78cbf204649bbae71662a115425c58f048d.tar.gz
cpython-41f0b78cbf204649bbae71662a115425c58f048d.tar.bz2
Simplify overlap() formula for case where variances are equal (GH-12323)
Diffstat (limited to 'Lib/statistics.py')
-rw-r--r--Lib/statistics.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/statistics.py b/Lib/statistics.py
index 97f1543..8d79eed 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -773,7 +773,7 @@ class NormalDist:
dv = Y_var - X_var
dm = fabs(Y.mu - X.mu)
if not dv:
- return 2.0 * NormalDist(dm, 2.0 * X.sigma).cdf(0)
+ return 1.0 - erf(dm / (2.0 * X.sigma * sqrt(2.0)))
a = X.mu * Y_var - Y.mu * X_var
b = X.sigma * Y.sigma * sqrt(dm**2.0 + dv * log(Y_var / X_var))
x1 = (a + b) / dv