Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger committed Aug 8, 2023
1 parent 22f151e commit 87ed56a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Lib/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ def _mean_stdev(data):

def _sqrtprod(x: float, y: float) -> float:
"Return sqrt(x * y) computed with high accuracy."
# Square root differential correction:
# https://www.wolframalpha.com/input/?i=Maclaurin+series+sqrt%28h**2+%2B+x%29+at+x%3D0
h = sqrt(x * y)
x = sumprod((x, h), (y, -h))
return h + x / (2.0 * h)
Expand Down

0 comments on commit 87ed56a

Please sign in to comment.