Lines Matching +full:abs +full:- +full:range
2 * Double-precision log(x) function.
4 * Copyright (c) 2018-2024, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
44 # define LO asuint64 (1.0 - 0x1p-5)
45 # define HI asuint64 (1.0 + 0x1.1p-5)
47 # define LO asuint64 (1.0 - 0x1p-4)
48 # define HI asuint64 (1.0 + 0x1.09p-4)
50 if (unlikely (ix - LO < HI - LO))
56 r = x - 1.0;
60 /* Worst-case error is around 0.516 ULP. */
63 w = B[0] * r2; /* B[0] == -0.5. */
65 y += r - hi + w;
68 /* Worst-case error is around 0.516 ULP. */
72 w = B[0] * r2; /* B[0] == -0.5. */
74 y += r - hi + w;
81 /* Worst-case error is around 0.532 ULP. */
82 w = B[0] * r2; /* B[0] == -0.5. */
84 y += r - hi + w;
87 /* Worst-case error is around 0.507 ULP. */
89 double_t rhi = r + w - w;
90 double_t rlo = r - rhi;
91 w = rhi * rhi * B[0]; /* B[0] == -0.5. */
93 lo = r - hi + w;
101 if (unlikely (top - 0x0010 >= 0x7ff0 - 0x0010))
103 /* x < 0x1p-1022 or inf or nan. */
112 ix -= 52ULL << 52;
115 /* x = 2^k z; where z is in range [OFF,2*OFF) and exact.
116 The range is split into N subintervals.
118 tmp = ix - OFF;
119 i = (tmp >> (52 - LOG_TABLE_BITS)) % N;
121 iz = ix - (tmp & 0xfffULL << 52);
126 /* log(x) = log1p(z/c-1) + log(c) + k*Ln2. */
127 /* r ~= z/c - 1, |r| < 1/(2*N). */
129 /* rounding error: 0x1p-55/N. */
130 r = fma (z, invc, -1.0);
132 /* rounding error: 0x1p-55/N + 0x1p-66. */
133 r = (z - T2[i].chi - T2[i].clo) * invc;
140 lo = w - hi + r + kd * Ln2lo;
142 /* log(x) = lo + (log1p(r) - r) + hi. */
143 r2 = r * r; /* rounding error: 0x1p-54/N^2. */
144 /* Worst case error if |y| > 0x1p-5:
145 0.5 + 4.13/N + abs-poly-error*2^57 ULP (+ 0.002 ULP without fma)
146 Worst case error if |y| > 0x1p-4:
147 0.5 + 2.06/N + abs-poly-error*2^56 ULP (+ 0.001 ULP without fma). */
170 TEST_INTERVAL (log, 0x1p-4, 0x1p4, 400000)