From: nsz Date: Tue, 13 Mar 2012 04:52:37 +0000 (+0100) Subject: use different const in __expo2 X-Git-Url: http://nsz.repo.hu/git/?p=libm;a=commitdiff_plain;h=4a1a5bbeb8516d59f7c964d1b7e744ef90b36c79;hp=5b0b42043c70ae677322aba55af6558eb2db6bb8 use different const in __expo2 --- 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;