summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-05 04:33:11 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-05 04:33:11 (GMT)
commite5ca6c71cd4a27f855612aeb14e600712cf72e04 (patch)
treee6a371b969aff6ed1d755cfa5df3e6c82572c3f0 /Modules
parent6fd0f0ac1e65d5c525beaef092464ecd0b8cab5e (diff)
downloadcpython-e5ca6c71cd4a27f855612aeb14e600712cf72e04.zip
cpython-e5ca6c71cd4a27f855612aeb14e600712cf72e04.tar.gz
cpython-e5ca6c71cd4a27f855612aeb14e600712cf72e04.tar.bz2
loghelper(): Try to nudge the compiler into doing mults in an order that
minimizes roundoff error.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mathmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index eef8b78..c206ddc 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -263,7 +263,7 @@ loghelper(PyObject* args, double (*func)(double), char *name)
log(x) + log(2) * e * SHIFT.
CAUTION: e*SHIFT may overflow using int arithmetic,
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);
}