From e5ca6c71cd4a27f855612aeb14e600712cf72e04 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Wed, 5 Sep 2001 04:33:11 +0000 Subject: [PATCH] loghelper(): Try to nudge the compiler into doing mults in an order that minimizes roundoff error. --- Modules/mathmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index eef8b78c3f..c206ddc031 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); } -- 2.40.0