Lines Matching +full:range +full:- +full:double
2 * Double-precision log10(x) function.
4 * Copyright (c) 2020-2024, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
22 #define LO asuint64 (1.0 - 0x1p-4)
23 #define HI asuint64 (1.0 + 0x1.09p-4)
25 /* Top 16 bits of a double. */
27 top16 (double x) in top16()
34 - Polynomials are computed for log10(1+r) with r on same intervals as log.
35 - Lookup parameters are scaled (at runtime) to switch from base e to
36 base 10. Many errors above 1.59 ulp are observed across the whole range of
38 log10(0x1.dc8710333a29bp-1) got -0x1.fee26884905a6p-6
39 want -0x1.fee26884905a8p-6. */
40 double
41 log10 (double x) in log10()
52 if (unlikely (ix - LO < HI - LO)) in log10()
58 r = x - 1.0; in log10()
66 /* Worst-case error is around 0.507 ULP. */ in log10()
68 double_t rhi = r + w - w; in log10()
69 double_t rlo = r - rhi; in log10()
72 lo = r - hi + w; in log10()
81 if (unlikely (top - 0x0010 >= 0x7ff0 - 0x0010)) in log10()
83 /* x < 0x1p-1022 or inf or nan. */ in log10()
92 ix -= 52ULL << 52; in log10()
95 /* x = 2^k z; where z is in range [OFF,2*OFF) and exact. in log10()
96 The range is split into N subintervals. in log10()
98 tmp = ix - OFF; in log10()
99 i = (tmp >> (52 - LOG10_TABLE_BITS)) % N; in log10()
101 iz = ix - (tmp & 0xfffULL << 52); in log10()
106 /* log(x) = log1p(z/c-1) + log(c) + k*Ln2. */ in log10()
107 /* r ~= z/c - 1, |r| < 1/(2*N). */ in log10()
109 /* rounding error: 0x1p-55/N. */ in log10()
110 r = fma (z, invc, -1.0); in log10()
112 /* rounding error: 0x1p-55/N + 0x1p-66. */ in log10()
113 r = (z - T2[i].chi - T2[i].clo) * invc; in log10()
120 lo = w - hi + r + kd * Ln2lo; in log10()
122 /* log10(x) = (w + r)/log(10) + (log10(1+r) - r/log(10)). */ in log10()
123 r2 = r * r; /* rounding error: 0x1p-54/N^2. */ in log10()
133 // clang-format off
138 long double in strong_alias()
139 log10l (long double x) in strong_alias()
145 // clang-format on
150 TEST_INTERVAL (log10, 0x1p-4, 0x1p4, 40000)