use different const in __expo2
authornsz <nsz@port70.net>
Tue, 13 Mar 2012 04:52:37 +0000 (05:52 +0100)
committernsz <nsz@port70.net>
Tue, 13 Mar 2012 04:52:37 +0000 (05:52 +0100)
src/math/__expo2.c
src/math/__expo2f.c

index 61ae7fd..7009306 100644 (file)
@@ -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;
index d35f440..7e61ba7 100644 (file)
@@ -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;