diff options
Diffstat (limited to 'math/aarch64/v_log_data.c')
-rw-r--r-- | math/aarch64/v_log_data.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/math/aarch64/v_log_data.c b/math/aarch64/v_log_data.c index 82351bb14766..4f0e6e167381 100644 --- a/math/aarch64/v_log_data.c +++ b/math/aarch64/v_log_data.c @@ -1,30 +1,35 @@ /* * Lookup table for double-precision log(x) vector function. * - * Copyright (c) 2019-2023, Arm Limited. + * Copyright (c) 2019-2024, Arm Limited. * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ -#include "v_math.h" - -#define N (1 << V_LOG_TABLE_BITS) +#include "math_config.h" const struct v_log_data __v_log_data = { + /* Worst-case error: 1.17 + 0.5 ulp. + Rel error: 0x1.6272e588p-56 in [ -0x1.fc1p-9 0x1.009p-8 ]. */ + .poly = { -0x1.ffffffffffff7p-2, 0x1.55555555170d4p-2, -0x1.0000000399c27p-2, + 0x1.999b2e90e94cap-3, -0x1.554e550bd501ep-3 }, + .ln2 = 0x1.62e42fefa39efp-1, /* Algorithm: x = 2^k z log(x) = k ln2 + log(c) + poly(z/c - 1) - where z is in [a;2a) which is split into N subintervals (a=0x1.69009p-1, - N=128) and log(c) and 1/c for the ith subinterval comes from lookup tables: + where z is in [a;2a) which is split into N subintervals (a=0x1.69009p-1, + N=128) and log(c) and 1/c for the ith subinterval comes from two lookup + tables: table[i].invc = 1/c table[i].logc = (double)log(c) - where c is near the center of the subinterval and is chosen by trying several - floating point invc candidates around 1/center and selecting one for which - the error in (double)log(c) is minimized (< 0x1p-74), except the subinterval - that contains 1 and the previous one got tweaked to avoid cancellation. */ + where c is near the center of the subinterval and is chosen by trying + several floating point invc candidates around 1/center and selecting one + for which the error in (double)log(c) is minimized (< 0x1p-74), except the + subinterval that contains 1 and the previous one got tweaked to avoid + cancellation. */ .table = { { 0x1.6a133d0dec120p+0, -0x1.62fe995eb963ap-2 }, { 0x1.6815f2f3e42edp+0, -0x1.5d5a48dad6b67p-2 }, { 0x1.661e39be1ac9ep+0, -0x1.57bde257d2769p-2 }, |