From 4a1a5bbeb8516d59f7c964d1b7e744ef90b36c79 Mon Sep 17 00:00:00 2001 From: nsz Date: Tue, 13 Mar 2012 05:52:37 +0100 Subject: [PATCH] use different const in __expo2 --- src/math/__expo2.c | 8 ++++---- src/math/__expo2f.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/math/__expo2.c b/src/math/__expo2.c index 61ae7fd..7009306 100644 --- a/src/math/__expo2.c +++ b/src/math/__expo2.c @@ -1,10 +1,10 @@ #include "libm.h" -/* k minimizes |exp(k ln2) - 2**k|, see cmath/__cexp.c */ -static const uint32_t k = 1799; -static const double kln2 = 1246.97177782734161156; +/* k is such that k*ln2 has minimal error */ +static const uint32_t k = 2043; +static const double kln2 = 0x1.62066151add8bp+10; -/* exp(x)/2 for large x */ +/* exp(x)/2 when x >= log(DBL_MAX) */ double __expo2(double x) { double scale; diff --git a/src/math/__expo2f.c b/src/math/__expo2f.c index d35f440..7e61ba7 100644 --- a/src/math/__expo2f.c +++ b/src/math/__expo2f.c @@ -1,6 +1,6 @@ #include "libm.h" -/* k minimizes |exp(k ln2) - 2**k|, see cmath/__cexpf.c */ +/* k is such that k*ln2 has minimal error */ static const uint32_t k = 235; static const float kln2 = 162.88958740f; -- 2.20.1