Lines Matching +full:ulp +full:- +full:0

2  * Double-precision 2^x function.
4 * Copyright (c) 2018-2024, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
18 #define C1 __exp_data.exp2_poly[0]
37 if ((ki & 0x80000000) == 0) in specialcase()
39 /* k > 0, the exponent of scale might have overflowed by 1. */ in specialcase()
40 sbits -= 1ull << 52; in specialcase()
45 /* k < 0, need special care in the subnormal range. */ in specialcase()
52 range to avoid double rounding that can cause 0.5+E/2 ulp error where in specialcase()
53 E is the worst-case ulp error outside the subnormal range. So this in specialcase()
54 is only useful if the goal is better than 1 ulp worst-case error. */ in specialcase()
56 lo = scale - y + scale * tmp; in specialcase()
58 lo = 1.0 - hi + y + lo; in specialcase()
59 y = eval_as_double (hi + lo) - 1.0; in specialcase()
60 /* Avoid -0.0 with downward rounding. */ in specialcase()
64 force_eval_double (opt_barrier_double (0x1p-1022) * 0x1p-1022); in specialcase()
66 y = 0x1p-1022 * y; in specialcase()
85 abstop = top12 (x) & 0x7ff; in exp2()
86 if (unlikely (abstop - top12 (0x1p-54) >= top12 (512.0) - top12 (0x1p-54))) in exp2()
88 if (abstop - top12 (0x1p-54) >= 0x80000000) in exp2()
90 /* Note: 0 is common input. */ in exp2()
94 if (asuint64 (x) == asuint64 (-INFINITY)) in exp2()
99 return __math_oflow (0); in exp2()
100 else if (asuint64 (x) >= asuint64 (-1075.0)) in exp2()
101 return __math_uflow (0); in exp2()
105 abstop = 0; in exp2()
108 /* exp2(x) = 2^(k/N) * 2^r, with 2^r in [2^(-1/2N),2^(1/2N)]. */ in exp2()
109 /* x = k/N + r, with int k and r in [-1/2N, 1/2N]. */ in exp2()
112 kd -= Shift; /* k/N for int k. */ in exp2()
113 r = x - kd; in exp2()
116 top = ki << (52 - EXP_TABLE_BITS); in exp2()
118 /* This is only a valid scale when -1023*N < k < 1024*N. */ in exp2()
120 /* exp2(x) = 2^(k/N) * 2^r ~= scale + scale * (tail + 2^r - 1). */ in exp2()
123 /* Without fma the worst case error is 0.5/N ulp larger. */ in exp2()
124 /* Worst case error is less than 0.5+0.86/N+(abs poly error * 2^53) ulp. */ in exp2()
132 if (unlikely (abstop == 0)) in exp2()
135 /* Note: tmp == 0 or |tmp| > 2^-65 and scale > 2^-928, so there in exp2()
147 TEST_SIG (S, D, 1, exp2, -9.9, 9.9)
150 TEST_INTERVAL (exp2, 0, 0xffff000000000000, 10000)
151 TEST_SYM_INTERVAL (exp2, 0x1p-6, 0x1p6, 40000)