Lines Matching +full:down +full:- +full:scaling

2  * Single-precision log(1+x) function.
4 * Copyright (c) 2022-2023, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
13 #define Ln2 (0x1.62e43p-1f)
28 /* 2.5 ulp variant. Approximate log(1+m) on [-0.25, 0.5] using in eval_poly()
51 /* 1.3 ulp variant. Approximate log(1+m) on [-0.25, 0.5] using Horner in eval_poly()
69 /* log1pf approximation using polynomial on reduced interval. Worst-case error
71 log1pf(0x1.21e13ap-2) got 0x1.fe8028p-3 want 0x1.fe802cp-3. */
86 /* x == -Inf => log1pf(x) = NaN. */ in log1pf()
97 /* x == -1.0 => log1pf(x) = -Inf. */ in log1pf()
98 return __math_divzerof (-1); in log1pf()
102 /* x == +/-NaN => log1pf(x) = NaN. */ in log1pf()
105 /* x < -1.0 => log1pf(x) = NaN. */ in log1pf()
110 is in [-0.25, 0.5]): in log1pf()
120 /* If x is in [-0.25, 0.5] then we can shortcut all the logic in log1pf()
129 reduce x to the range [-0.25, 0.5]. Inside this range, k is 0. in log1pf()
131 let k = sign * 2^p where sign = -1 if x < 0 in log1pf()
135 int k = (asuint (m) - 0x3f400000) & 0xff800000; in log1pf()
137 /* By using integer arithmetic, we obtain the necessary scaling by in log1pf()
139 float m_scale = asfloat (asuint (x) - k); in log1pf()
142 fp32 number (s in [2**-126,2**26]), and scale m down accordingly. */ in log1pf()
143 float s = asfloat (asuint (4.0f) - k); in log1pf()
144 m_scale = m_scale + fmaf (0.25f, s, -1.0f); in log1pf()
148 /* The scale factor to be applied back at the end - by multiplying float(k) in log1pf()
149 by 2^-23 we get the unbiased exponent of k. */ in log1pf()
150 float scale_back = (float) k * 0x1.0p-23f; in log1pf()
152 /* Apply the scaling back. */ in log1pf()
156 PL_SIG (S, F, 1, log1p, -0.9, 10.0)
158 PL_TEST_SYM_INTERVAL (log1pf, 0.0, 0x1p-23, 50000)
159 PL_TEST_SYM_INTERVAL (log1pf, 0x1p-23, 0.001, 50000)