aboutsummaryrefslogtreecommitdiff
path: root/pl/math/v_log2_3u.c
diff options
context:
space:
mode:
authorNicholas Dingle <Nicholas.Dingle@arm.com>2022-11-15 14:55:06 +0000
committerJoe Ramsay <joe.ramsay@arm.com>2022-11-15 14:55:06 +0000
commitc1cf1eb0ad5fb98c4c14e8e83e00b779d1e646a2 (patch)
tree7ba2bb2e9937fc95cfed4175333b5456cf2a206f /pl/math/v_log2_3u.c
parent3560d66f2efb0164821681e5006280b2f6dadd07 (diff)
downloadarm-optimized-routines-c1cf1eb0ad5fb98c4c14e8e83e00b779d1e646a2.tar.gz
pl/math: Use order-6 polynomial in Vector/Neon log2
Reduce the order of the polynomial used in Neon log2 by one (from 7 to 6). In order to calculate the new coefficients required we rescale the coefficients from log_data.c by log2(e) in extended precision and round back. The maximum observed error is unchanged (2.59 ULPs) but the point at which it is observed has changed slightly.
Diffstat (limited to 'pl/math/v_log2_3u.c')
-rw-r--r--pl/math/v_log2_3u.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/pl/math/v_log2_3u.c b/pl/math/v_log2_3u.c
index b076874..af7340d 100644
--- a/pl/math/v_log2_3u.c
+++ b/pl/math/v_log2_3u.c
@@ -46,8 +46,8 @@ specialcase (v_f64_t x, v_f64_t y, v_u64_t cmp)
/* Double-precision vector log2 routine. Implements the same algorithm as vector
log10, with coefficients and table entries scaled in extended precision.
The maximum observed error is 2.59 ULP:
- __v_log2(0x1.0b556e53a80b6p+0) got 0x1.fffbc594d146bp-5
- want 0x1.fffbc594d146ep-5. */
+ __v_log2(0x1.0b555054a9bd1p+0) got 0x1.fff6977bdced3p-5
+ want 0x1.fff6977bdced6p-5. */
VPCS_ATTR
v_f64_t V_NAME (log2) (v_f64_t x)
{
@@ -73,10 +73,9 @@ v_f64_t V_NAME (log2) (v_f64_t x)
v_f64_t w = v_fma_f64 (r, InvLn2, e.log2c);
v_f64_t r2 = r * r;
- v_f64_t p_45 = v_fma_f64 (P (5), r, P (4));
v_f64_t p_23 = v_fma_f64 (P (3), r, P (2));
v_f64_t p_01 = v_fma_f64 (P (1), r, P (0));
- v_f64_t y = v_fma_f64 (r2, p_45, p_23);
+ v_f64_t y = v_fma_f64 (P (4), r2, p_23);
y = v_fma_f64 (r2, y, p_01);
y = v_fma_f64 (r2, y, kd + w);