Kaydet (Commit) d2d23784 authored tarafından Mark Dickinson's avatar Mark Dickinson

Merged revisions 82595 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r82595 | mark.dickinson | 2010-07-05 21:14:26 +0100 (Mon, 05 Jul 2010) | 1 line

  Post-detabification cleanup.
........
üst 690959f1
...@@ -56,13 +56,13 @@ _Py_acosh(double x) ...@@ -56,13 +56,13 @@ _Py_acosh(double x)
if (Py_IS_INFINITY(x)) { if (Py_IS_INFINITY(x)) {
return x+x; return x+x;
} else { } else {
return log(x)+ln2; /* acosh(huge)=log(2x) */ return log(x)+ln2; /* acosh(huge)=log(2x) */
} }
} }
else if (x == 1.) { else if (x == 1.) {
return 0.0; /* acosh(1) = 0 */ return 0.0; /* acosh(1) = 0 */
} }
else if (x > 2.) { /* 2 < x < 2**28 */ else if (x > 2.) { /* 2 < x < 2**28 */
double t = x*x; double t = x*x;
return log(2.0*x - 1.0 / (x + sqrt(t - 1.0))); return log(2.0*x - 1.0 / (x + sqrt(t - 1.0)));
} }
...@@ -94,7 +94,7 @@ _Py_asinh(double x) ...@@ -94,7 +94,7 @@ _Py_asinh(double x)
return x+x; return x+x;
} }
if (absx < two_pow_m28) { /* |x| < 2**-28 */ if (absx < two_pow_m28) { /* |x| < 2**-28 */
return x; /* return x inexact except 0 */ return x; /* return x inexact except 0 */
} }
if (absx > two_pow_p28) { /* |x| > 2**28 */ if (absx > two_pow_p28) { /* |x| > 2**28 */
w = log(absx)+ln2; w = log(absx)+ln2;
...@@ -114,9 +114,9 @@ _Py_asinh(double x) ...@@ -114,9 +114,9 @@ _Py_asinh(double x)
* Method : * Method :
* 1.Reduced x to positive by atanh(-x) = -atanh(x) * 1.Reduced x to positive by atanh(-x) = -atanh(x)
* 2.For x>=0.5 * 2.For x>=0.5
* 1 2x x * 1 2x x
* atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * -------)
* 2 1 - x 1 - x * 2 1 - x 1 - x
* *
* For x<0.5 * For x<0.5
* atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) * atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
...@@ -194,7 +194,7 @@ _Py_log1p(double x) ...@@ -194,7 +194,7 @@ _Py_log1p(double x)
/* For x small, we use the following approach. Let y be the nearest float /* For x small, we use the following approach. Let y be the nearest float
to 1+x, then to 1+x, then
1+x = y * (1 - (y-1-x)/y) 1+x = y * (1 - (y-1-x)/y)
so log(1+x) = log(y) + log(1-(y-1-x)/y). Since (y-1-x)/y is tiny, the so log(1+x) = log(y) + log(1-(y-1-x)/y). Since (y-1-x)/y is tiny, the
second term is well approximated by (y-1-x)/y. If abs(x) >= second term is well approximated by (y-1-x)/y. If abs(x) >=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment