Commit e5ca6c71 authored by Tim Peters's avatar Tim Peters

loghelper(): Try to nudge the compiler into doing mults in an order that

minimizes roundoff error.
parent 6fd0f0ac
...@@ -263,7 +263,7 @@ loghelper(PyObject* args, double (*func)(double), char *name) ...@@ -263,7 +263,7 @@ loghelper(PyObject* args, double (*func)(double), char *name)
log(x) + log(2) * e * SHIFT. log(x) + log(2) * e * SHIFT.
CAUTION: e*SHIFT may overflow using int arithmetic, CAUTION: e*SHIFT may overflow using int arithmetic,
so force use of double. */ so force use of double. */
x = func(x) + func(2.0) * (double)e * (double)SHIFT; x = func(x) + (e * (double)SHIFT) * func(2.0);
return PyFloat_FromDouble(x); return PyFloat_FromDouble(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