aboutsummaryrefslogtreecommitdiff
path: root/pl/math/log1p_2u.c
diff options
context:
space:
mode:
authorJoe Ramsay <Joe.Ramsay@arm.com>2022-12-09 12:19:38 +0000
committerJoe Ramsay <joe.ramsay@arm.com>2022-12-09 12:19:38 +0000
commitbc7cc9d2a762a26b2fcbf150b3fc9c6993ffa16c (patch)
tree0b06cfa5fab3f8f594ff16a1d093a92412e8fb86 /pl/math/log1p_2u.c
parent132d2f5da6155e64ff39a54fdbb46145a3892d6a (diff)
downloadarm-optimized-routines-bc7cc9d2a762a26b2fcbf150b3fc9c6993ffa16c.tar.gz
pl/math: Add polynomial helpers
Add macros for simplifying polynomial evaluation using either Horner, pairwise Horner or Estrin. Several routines have been modified to use the new helpers. Readability is improved slightly, and we expect that this will make prototyping new routines simpler.
Diffstat (limited to 'pl/math/log1p_2u.c')
-rw-r--r--pl/math/log1p_2u.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pl/math/log1p_2u.c b/pl/math/log1p_2u.c
index b9c7e9e..ade5d87 100644
--- a/pl/math/log1p_2u.c
+++ b/pl/math/log1p_2u.c
@@ -5,8 +5,7 @@
*/
#include "math_config.h"
-
-#include "log1p_common.h"
+#include "estrin.h"
#define Ln2Hi 0x1.62e42fefa3800p-1
#define Ln2Lo 0x1.ef35793c76730p-45
@@ -19,6 +18,16 @@
#define Rt2MOne 0x3fda827999fcef32
#define AbsMask 0x7fffffffffffffff
#define ExpM63 0x3c00
+#define C(i) __log1p_data.coeffs[i]
+
+static inline double
+eval_poly (double f)
+{
+ double f2 = f * f;
+ double f4 = f2 * f2;
+ double f8 = f4 * f4;
+ return ESTRIN_18 (f, f2, f4, f8, f8 * f8, C);
+}
/* log1p approximation using polynomial on reduced interval. Largest
observed errors are near the lower boundary of the region where k