Lines Matching +full:hi +full:- +full:z

2  * Double-precision SVE log10(x) function.
4 * Copyright (c) 2022-2024, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
14 #define Thres 0x7fe0000000000000 /* Max - Min. */
25 .c0 = -0x1.bcb7b1526e506p-3,
26 .c1 = 0x1.287a7636be1d1p-3,
27 .c2 = -0x1.bcb7b158af938p-4,
28 .c3 = 0x1.63c78734e6d07p-4,
29 .c4 = -0x1.287461742fee4p-4,
30 .invln10 = 0x1.bcb7b1526e50ep-2,
31 .log10_2 = 0x1.34413509f79ffp-2,
36 special_case (svfloat64_t hi, svuint64_t tmp, svfloat64_t y, svfloat64_t r2, in special_case() argument
39 svfloat64_t x = svreinterpret_f64 (svadd_x (svptrue_b64 (), tmp, d->off)); in special_case()
40 return sv_call_f64 (log10, x, svmla_x (svptrue_b64 (), hi, r2, y), special); in special_case()
43 /* Double-precision SVE log10 routine.
45 SV_NAME_D1 (log10)(0x1.131956cd4b627p+0) got 0x1.fffbdf6eaa669p-6
46 want 0x1.fffbdf6eaa667p-6. */
54 /* x = 2^k z; where z is in range [Off,2*Off) and exact. in SV_NAME_D1()
56 The ith subinterval contains z and c is near its center. */ in SV_NAME_D1()
57 svuint64_t tmp = svsub_x (pg, ix, d->off); in SV_NAME_D1()
58 svuint64_t i = svlsr_x (pg, tmp, 51 - V_LOG10_TABLE_BITS); in SV_NAME_D1()
59 i = svand_x (pg, i, (N - 1) << 1); in SV_NAME_D1()
61 svfloat64_t z = svreinterpret_f64 ( in SV_NAME_D1() local
64 /* log(x) = k*log(2) + log(c) + log(z/c). */ in SV_NAME_D1()
69 /* We approximate log(z/c) with a polynomial P(x) ~= log(x + 1): in SV_NAME_D1()
70 r = z/c - 1 (we look up precomputed 1/c) in SV_NAME_D1()
71 log(z/c) ~= P(r). */ in SV_NAME_D1()
72 svfloat64_t r = svmad_x (pg, invc, z, -1.0); in SV_NAME_D1()
74 /* hi = log(c) + k*log(2). */ in SV_NAME_D1()
75 svfloat64_t invln10_log10_2 = svld1rq_f64 (svptrue_b64 (), &d->invln10); in SV_NAME_D1()
77 svfloat64_t hi = svmla_lane_f64 (w, k, invln10_log10_2, 1); in SV_NAME_D1() local
79 /* y = r2*(A0 + r*A1 + r2*(A2 + r*A3 + r2*A4)) + hi. */ in SV_NAME_D1()
80 svfloat64_t odd_coeffs = svld1rq_f64 (svptrue_b64 (), &d->c1); in SV_NAME_D1()
82 svfloat64_t y = svmla_lane_f64 (sv_f64 (d->c2), r, odd_coeffs, 1); in SV_NAME_D1()
83 svfloat64_t p = svmla_lane_f64 (sv_f64 (d->c0), r, odd_coeffs, 0); in SV_NAME_D1()
84 y = svmla_x (pg, y, r2, d->c4); in SV_NAME_D1()
88 return special_case (hi, tmp, y, r2, special, d); in SV_NAME_D1()
89 return svmla_x (pg, hi, r2, y); in SV_NAME_D1()
95 TEST_INTERVAL (SV_NAME_D1 (log10), -0.0, -0x1p126, 100)
96 TEST_INTERVAL (SV_NAME_D1 (log10), 0x1p-149, 0x1p-126, 4000)
97 TEST_INTERVAL (SV_NAME_D1 (log10), 0x1p-126, 0x1p-23, 50000)
98 TEST_INTERVAL (SV_NAME_D1 (log10), 0x1p-23, 1.0, 50000)