1f9f848faSopenharmony_ci/*- 2f9f848faSopenharmony_ci * SPDX-License-Identifier: BSD-2-Clause 3f9f848faSopenharmony_ci * 4f9f848faSopenharmony_ci * Copyright (c) 2009-2013 Steven G. Kargl 5f9f848faSopenharmony_ci * All rights reserved. 6f9f848faSopenharmony_ci * 7f9f848faSopenharmony_ci * Redistribution and use in source and binary forms, with or without 8f9f848faSopenharmony_ci * modification, are permitted provided that the following conditions 9f9f848faSopenharmony_ci * are met: 10f9f848faSopenharmony_ci * 1. Redistributions of source code must retain the above copyright 11f9f848faSopenharmony_ci * notice unmodified, this list of conditions, and the following 12f9f848faSopenharmony_ci * disclaimer. 13f9f848faSopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 14f9f848faSopenharmony_ci * notice, this list of conditions and the following disclaimer in the 15f9f848faSopenharmony_ci * documentation and/or other materials provided with the distribution. 16f9f848faSopenharmony_ci * 17f9f848faSopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18f9f848faSopenharmony_ci * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19f9f848faSopenharmony_ci * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20f9f848faSopenharmony_ci * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21f9f848faSopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22f9f848faSopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23f9f848faSopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24f9f848faSopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25f9f848faSopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26f9f848faSopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27f9f848faSopenharmony_ci * 28f9f848faSopenharmony_ci * Optimized by Bruce D. Evans. 29f9f848faSopenharmony_ci */ 30f9f848faSopenharmony_ci 31f9f848faSopenharmony_ci#include <sys/cdefs.h> 32f9f848faSopenharmony_ci/* 33f9f848faSopenharmony_ci * ld128 version of s_expl.c. See ../ld80/s_expl.c for most comments. 34f9f848faSopenharmony_ci */ 35f9f848faSopenharmony_ci 36f9f848faSopenharmony_ci#include <float.h> 37f9f848faSopenharmony_ci 38f9f848faSopenharmony_ci#include "fpmath.h" 39f9f848faSopenharmony_ci#include "math.h" 40f9f848faSopenharmony_ci#include "math_private.h" 41f9f848faSopenharmony_ci#include "k_expl.h" 42f9f848faSopenharmony_ci 43f9f848faSopenharmony_ci/* XXX Prevent compilers from erroneously constant folding these: */ 44f9f848faSopenharmony_cistatic const volatile long double 45f9f848faSopenharmony_cihuge = 0x1p10000L, 46f9f848faSopenharmony_citiny = 0x1p-10000L; 47f9f848faSopenharmony_ci 48f9f848faSopenharmony_cistatic const long double 49f9f848faSopenharmony_citwom10000 = 0x1p-10000L; 50f9f848faSopenharmony_ci 51f9f848faSopenharmony_cistatic const long double 52f9f848faSopenharmony_ci/* log(2**16384 - 0.5) rounded towards zero: */ 53f9f848faSopenharmony_ci/* log(2**16384 - 0.5 + 1) rounded towards zero for expm1l() is the same: */ 54f9f848faSopenharmony_cio_threshold = 11356.523406294143949491931077970763428L, 55f9f848faSopenharmony_ci/* log(2**(-16381-64-1)) rounded towards zero: */ 56f9f848faSopenharmony_ciu_threshold = -11433.462743336297878837243843452621503L; 57f9f848faSopenharmony_ci 58f9f848faSopenharmony_cilong double 59f9f848faSopenharmony_ciexpl(long double x) 60f9f848faSopenharmony_ci{ 61f9f848faSopenharmony_ci union IEEEl2bits u; 62f9f848faSopenharmony_ci long double hi, lo, t, twopk; 63f9f848faSopenharmony_ci int k; 64f9f848faSopenharmony_ci uint16_t hx, ix; 65f9f848faSopenharmony_ci 66f9f848faSopenharmony_ci DOPRINT_START(&x); 67f9f848faSopenharmony_ci 68f9f848faSopenharmony_ci /* Filter out exceptional cases. */ 69f9f848faSopenharmony_ci u.e = x; 70f9f848faSopenharmony_ci hx = u.xbits.expsign; 71f9f848faSopenharmony_ci ix = hx & 0x7fff; 72f9f848faSopenharmony_ci if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ 73f9f848faSopenharmony_ci if (ix == BIAS + LDBL_MAX_EXP) { 74f9f848faSopenharmony_ci if (hx & 0x8000) /* x is -Inf or -NaN */ 75f9f848faSopenharmony_ci RETURNP(-1 / x); 76f9f848faSopenharmony_ci RETURNP(x + x); /* x is +Inf or +NaN */ 77f9f848faSopenharmony_ci } 78f9f848faSopenharmony_ci if (x > o_threshold) 79f9f848faSopenharmony_ci RETURNP(huge * huge); 80f9f848faSopenharmony_ci if (x < u_threshold) 81f9f848faSopenharmony_ci RETURNP(tiny * tiny); 82f9f848faSopenharmony_ci } else if (ix < BIAS - 114) { /* |x| < 0x1p-114 */ 83f9f848faSopenharmony_ci RETURN2P(1, x); /* 1 with inexact iff x != 0 */ 84f9f848faSopenharmony_ci } 85f9f848faSopenharmony_ci 86f9f848faSopenharmony_ci ENTERI(); 87f9f848faSopenharmony_ci 88f9f848faSopenharmony_ci twopk = 1; 89f9f848faSopenharmony_ci __k_expl(x, &hi, &lo, &k); 90f9f848faSopenharmony_ci t = SUM2P(hi, lo); 91f9f848faSopenharmony_ci 92f9f848faSopenharmony_ci /* Scale by 2**k. */ 93f9f848faSopenharmony_ci /* 94f9f848faSopenharmony_ci * XXX sparc64 multiplication was so slow that scalbnl() is faster, 95f9f848faSopenharmony_ci * but performance on aarch64 and riscv hasn't yet been quantified. 96f9f848faSopenharmony_ci */ 97f9f848faSopenharmony_ci if (k >= LDBL_MIN_EXP) { 98f9f848faSopenharmony_ci if (k == LDBL_MAX_EXP) 99f9f848faSopenharmony_ci RETURNI(t * 2 * 0x1p16383L); 100f9f848faSopenharmony_ci SET_LDBL_EXPSIGN(twopk, BIAS + k); 101f9f848faSopenharmony_ci RETURNI(t * twopk); 102f9f848faSopenharmony_ci } else { 103f9f848faSopenharmony_ci SET_LDBL_EXPSIGN(twopk, BIAS + k + 10000); 104f9f848faSopenharmony_ci RETURNI(t * twopk * twom10000); 105f9f848faSopenharmony_ci } 106f9f848faSopenharmony_ci} 107f9f848faSopenharmony_ci 108f9f848faSopenharmony_ci/* 109f9f848faSopenharmony_ci * Our T1 and T2 are chosen to be approximately the points where method 110f9f848faSopenharmony_ci * A and method B have the same accuracy. Tang's T1 and T2 are the 111f9f848faSopenharmony_ci * points where method A's accuracy changes by a full bit. For Tang, 112f9f848faSopenharmony_ci * this drop in accuracy makes method A immediately less accurate than 113f9f848faSopenharmony_ci * method B, but our larger INTERVALS makes method A 2 bits more 114f9f848faSopenharmony_ci * accurate so it remains the most accurate method significantly 115f9f848faSopenharmony_ci * closer to the origin despite losing the full bit in our extended 116f9f848faSopenharmony_ci * range for it. 117f9f848faSopenharmony_ci * 118f9f848faSopenharmony_ci * Split the interval [T1, T2] into two intervals [T1, T3] and [T3, T2]. 119f9f848faSopenharmony_ci * Setting T3 to 0 would require the |x| < 0x1p-113 condition to appear 120f9f848faSopenharmony_ci * in both subintervals, so set T3 = 2**-5, which places the condition 121f9f848faSopenharmony_ci * into the [T1, T3] interval. 122f9f848faSopenharmony_ci * 123f9f848faSopenharmony_ci * XXX we now do this more to (partially) balance the number of terms 124f9f848faSopenharmony_ci * in the C and D polys than to avoid checking the condition in both 125f9f848faSopenharmony_ci * intervals. 126f9f848faSopenharmony_ci * 127f9f848faSopenharmony_ci * XXX these micro-optimizations are excessive. 128f9f848faSopenharmony_ci */ 129f9f848faSopenharmony_cistatic const double 130f9f848faSopenharmony_ciT1 = -0.1659, /* ~-30.625/128 * log(2) */ 131f9f848faSopenharmony_ciT2 = 0.1659, /* ~30.625/128 * log(2) */ 132f9f848faSopenharmony_ciT3 = 0.03125; 133f9f848faSopenharmony_ci 134f9f848faSopenharmony_ci/* 135f9f848faSopenharmony_ci * Domain [-0.1659, 0.03125], range ~[2.9134e-44, 1.8404e-37]: 136f9f848faSopenharmony_ci * |(exp(x)-1-x-x**2/2)/x - p(x)| < 2**-122.03 137f9f848faSopenharmony_ci * 138f9f848faSopenharmony_ci * XXX none of the long double C or D coeffs except C10 is correctly printed. 139f9f848faSopenharmony_ci * If you re-print their values in %.35Le format, the result is always 140f9f848faSopenharmony_ci * different. For example, the last 2 digits in C3 should be 59, not 67. 141f9f848faSopenharmony_ci * 67 is apparently from rounding an extra-precision value to 36 decimal 142f9f848faSopenharmony_ci * places. 143f9f848faSopenharmony_ci */ 144f9f848faSopenharmony_cistatic const long double 145f9f848faSopenharmony_ciC3 = 1.66666666666666666666666666666666667e-1L, 146f9f848faSopenharmony_ciC4 = 4.16666666666666666666666666666666645e-2L, 147f9f848faSopenharmony_ciC5 = 8.33333333333333333333333333333371638e-3L, 148f9f848faSopenharmony_ciC6 = 1.38888888888888888888888888891188658e-3L, 149f9f848faSopenharmony_ciC7 = 1.98412698412698412698412697235950394e-4L, 150f9f848faSopenharmony_ciC8 = 2.48015873015873015873015112487849040e-5L, 151f9f848faSopenharmony_ciC9 = 2.75573192239858906525606685484412005e-6L, 152f9f848faSopenharmony_ciC10 = 2.75573192239858906612966093057020362e-7L, 153f9f848faSopenharmony_ciC11 = 2.50521083854417203619031960151253944e-8L, 154f9f848faSopenharmony_ciC12 = 2.08767569878679576457272282566520649e-9L, 155f9f848faSopenharmony_ciC13 = 1.60590438367252471783548748824255707e-10L; 156f9f848faSopenharmony_ci 157f9f848faSopenharmony_ci/* 158f9f848faSopenharmony_ci * XXX this has 1 more coeff than needed. 159f9f848faSopenharmony_ci * XXX can start the double coeffs but not the double mults at C10. 160f9f848faSopenharmony_ci * With my coeffs (C10-C17 double; s = best_s): 161f9f848faSopenharmony_ci * Domain [-0.1659, 0.03125], range ~[-1.1976e-37, 1.1976e-37]: 162f9f848faSopenharmony_ci * |(exp(x)-1-x-x**2/2)/x - p(x)| ~< 2**-122.65 163f9f848faSopenharmony_ci */ 164f9f848faSopenharmony_cistatic const double 165f9f848faSopenharmony_ciC14 = 1.1470745580491932e-11, /* 0x1.93974a81dae30p-37 */ 166f9f848faSopenharmony_ciC15 = 7.6471620181090468e-13, /* 0x1.ae7f3820adab1p-41 */ 167f9f848faSopenharmony_ciC16 = 4.7793721460260450e-14, /* 0x1.ae7cd18a18eacp-45 */ 168f9f848faSopenharmony_ciC17 = 2.8074757356658877e-15, /* 0x1.949992a1937d9p-49 */ 169f9f848faSopenharmony_ciC18 = 1.4760610323699476e-16; /* 0x1.545b43aabfbcdp-53 */ 170f9f848faSopenharmony_ci 171f9f848faSopenharmony_ci/* 172f9f848faSopenharmony_ci * Domain [0.03125, 0.1659], range ~[-2.7676e-37, -1.0367e-38]: 173f9f848faSopenharmony_ci * |(exp(x)-1-x-x**2/2)/x - p(x)| < 2**-121.44 174f9f848faSopenharmony_ci */ 175f9f848faSopenharmony_cistatic const long double 176f9f848faSopenharmony_ciD3 = 1.66666666666666666666666666666682245e-1L, 177f9f848faSopenharmony_ciD4 = 4.16666666666666666666666666634228324e-2L, 178f9f848faSopenharmony_ciD5 = 8.33333333333333333333333364022244481e-3L, 179f9f848faSopenharmony_ciD6 = 1.38888888888888888888887138722762072e-3L, 180f9f848faSopenharmony_ciD7 = 1.98412698412698412699085805424661471e-4L, 181f9f848faSopenharmony_ciD8 = 2.48015873015873015687993712101479612e-5L, 182f9f848faSopenharmony_ciD9 = 2.75573192239858944101036288338208042e-6L, 183f9f848faSopenharmony_ciD10 = 2.75573192239853161148064676533754048e-7L, 184f9f848faSopenharmony_ciD11 = 2.50521083855084570046480450935267433e-8L, 185f9f848faSopenharmony_ciD12 = 2.08767569819738524488686318024854942e-9L, 186f9f848faSopenharmony_ciD13 = 1.60590442297008495301927448122499313e-10L; 187f9f848faSopenharmony_ci 188f9f848faSopenharmony_ci/* 189f9f848faSopenharmony_ci * XXX this has 1 more coeff than needed. 190f9f848faSopenharmony_ci * XXX can start the double coeffs but not the double mults at D11. 191f9f848faSopenharmony_ci * With my coeffs (D11-D16 double): 192f9f848faSopenharmony_ci * Domain [0.03125, 0.1659], range ~[-1.1980e-37, 1.1980e-37]: 193f9f848faSopenharmony_ci * |(exp(x)-1-x-x**2/2)/x - p(x)| ~< 2**-122.65 194f9f848faSopenharmony_ci */ 195f9f848faSopenharmony_cistatic const double 196f9f848faSopenharmony_ciD14 = 1.1470726176204336e-11, /* 0x1.93971dc395d9ep-37 */ 197f9f848faSopenharmony_ciD15 = 7.6478532249581686e-13, /* 0x1.ae892e3D16fcep-41 */ 198f9f848faSopenharmony_ciD16 = 4.7628892832607741e-14, /* 0x1.ad00Dfe41feccp-45 */ 199f9f848faSopenharmony_ciD17 = 3.0524857220358650e-15; /* 0x1.D7e8d886Df921p-49 */ 200f9f848faSopenharmony_ci 201f9f848faSopenharmony_cilong double 202f9f848faSopenharmony_ciexpm1l(long double x) 203f9f848faSopenharmony_ci{ 204f9f848faSopenharmony_ci union IEEEl2bits u, v; 205f9f848faSopenharmony_ci long double hx2_hi, hx2_lo, q, r, r1, t, twomk, twopk, x_hi; 206f9f848faSopenharmony_ci long double x_lo, x2; 207f9f848faSopenharmony_ci double dr, dx, fn, r2; 208f9f848faSopenharmony_ci int k, n, n2; 209f9f848faSopenharmony_ci uint16_t hx, ix; 210f9f848faSopenharmony_ci 211f9f848faSopenharmony_ci DOPRINT_START(&x); 212f9f848faSopenharmony_ci 213f9f848faSopenharmony_ci /* Filter out exceptional cases. */ 214f9f848faSopenharmony_ci u.e = x; 215f9f848faSopenharmony_ci hx = u.xbits.expsign; 216f9f848faSopenharmony_ci ix = hx & 0x7fff; 217f9f848faSopenharmony_ci if (ix >= BIAS + 7) { /* |x| >= 128 or x is NaN */ 218f9f848faSopenharmony_ci if (ix == BIAS + LDBL_MAX_EXP) { 219f9f848faSopenharmony_ci if (hx & 0x8000) /* x is -Inf or -NaN */ 220f9f848faSopenharmony_ci RETURNP(-1 / x - 1); 221f9f848faSopenharmony_ci RETURNP(x + x); /* x is +Inf or +NaN */ 222f9f848faSopenharmony_ci } 223f9f848faSopenharmony_ci if (x > o_threshold) 224f9f848faSopenharmony_ci RETURNP(huge * huge); 225f9f848faSopenharmony_ci /* 226f9f848faSopenharmony_ci * expm1l() never underflows, but it must avoid 227f9f848faSopenharmony_ci * unrepresentable large negative exponents. We used a 228f9f848faSopenharmony_ci * much smaller threshold for large |x| above than in 229f9f848faSopenharmony_ci * expl() so as to handle not so large negative exponents 230f9f848faSopenharmony_ci * in the same way as large ones here. 231f9f848faSopenharmony_ci */ 232f9f848faSopenharmony_ci if (hx & 0x8000) /* x <= -128 */ 233f9f848faSopenharmony_ci RETURN2P(tiny, -1); /* good for x < -114ln2 - eps */ 234f9f848faSopenharmony_ci } 235f9f848faSopenharmony_ci 236f9f848faSopenharmony_ci ENTERI(); 237f9f848faSopenharmony_ci 238f9f848faSopenharmony_ci if (T1 < x && x < T2) { 239f9f848faSopenharmony_ci x2 = x * x; 240f9f848faSopenharmony_ci dx = x; 241f9f848faSopenharmony_ci 242f9f848faSopenharmony_ci if (x < T3) { 243f9f848faSopenharmony_ci if (ix < BIAS - 113) { /* |x| < 0x1p-113 */ 244f9f848faSopenharmony_ci /* x (rounded) with inexact if x != 0: */ 245f9f848faSopenharmony_ci RETURNPI(x == 0 ? x : 246f9f848faSopenharmony_ci (0x1p200 * x + fabsl(x)) * 0x1p-200); 247f9f848faSopenharmony_ci } 248f9f848faSopenharmony_ci q = x * x2 * C3 + x2 * x2 * (C4 + x * (C5 + x * (C6 + 249f9f848faSopenharmony_ci x * (C7 + x * (C8 + x * (C9 + x * (C10 + 250f9f848faSopenharmony_ci x * (C11 + x * (C12 + x * (C13 + 251f9f848faSopenharmony_ci dx * (C14 + dx * (C15 + dx * (C16 + 252f9f848faSopenharmony_ci dx * (C17 + dx * C18)))))))))))))); 253f9f848faSopenharmony_ci } else { 254f9f848faSopenharmony_ci q = x * x2 * D3 + x2 * x2 * (D4 + x * (D5 + x * (D6 + 255f9f848faSopenharmony_ci x * (D7 + x * (D8 + x * (D9 + x * (D10 + 256f9f848faSopenharmony_ci x * (D11 + x * (D12 + x * (D13 + 257f9f848faSopenharmony_ci dx * (D14 + dx * (D15 + dx * (D16 + 258f9f848faSopenharmony_ci dx * D17))))))))))))); 259f9f848faSopenharmony_ci } 260f9f848faSopenharmony_ci 261f9f848faSopenharmony_ci x_hi = (float)x; 262f9f848faSopenharmony_ci x_lo = x - x_hi; 263f9f848faSopenharmony_ci hx2_hi = x_hi * x_hi / 2; 264f9f848faSopenharmony_ci hx2_lo = x_lo * (x + x_hi) / 2; 265f9f848faSopenharmony_ci if (ix >= BIAS - 7) 266f9f848faSopenharmony_ci RETURN2PI(hx2_hi + x_hi, hx2_lo + x_lo + q); 267f9f848faSopenharmony_ci else 268f9f848faSopenharmony_ci RETURN2PI(x, hx2_lo + q + hx2_hi); 269f9f848faSopenharmony_ci } 270f9f848faSopenharmony_ci 271f9f848faSopenharmony_ci /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ 272f9f848faSopenharmony_ci fn = rnint((double)x * INV_L); 273f9f848faSopenharmony_ci n = irint(fn); 274f9f848faSopenharmony_ci n2 = (unsigned)n % INTERVALS; 275f9f848faSopenharmony_ci k = n >> LOG2_INTERVALS; 276f9f848faSopenharmony_ci r1 = x - fn * L1; 277f9f848faSopenharmony_ci r2 = fn * -L2; 278f9f848faSopenharmony_ci r = r1 + r2; 279f9f848faSopenharmony_ci 280f9f848faSopenharmony_ci /* Prepare scale factor. */ 281f9f848faSopenharmony_ci v.e = 1; 282f9f848faSopenharmony_ci v.xbits.expsign = BIAS + k; 283f9f848faSopenharmony_ci twopk = v.e; 284f9f848faSopenharmony_ci 285f9f848faSopenharmony_ci /* 286f9f848faSopenharmony_ci * Evaluate lower terms of 287f9f848faSopenharmony_ci * expl(endpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). 288f9f848faSopenharmony_ci */ 289f9f848faSopenharmony_ci dr = r; 290f9f848faSopenharmony_ci q = r2 + r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + 291f9f848faSopenharmony_ci dr * (A7 + dr * (A8 + dr * (A9 + dr * A10)))))))); 292f9f848faSopenharmony_ci 293f9f848faSopenharmony_ci t = tbl[n2].lo + tbl[n2].hi; 294f9f848faSopenharmony_ci 295f9f848faSopenharmony_ci if (k == 0) { 296f9f848faSopenharmony_ci t = SUM2P(tbl[n2].hi - 1, tbl[n2].lo * (r1 + 1) + t * q + 297f9f848faSopenharmony_ci tbl[n2].hi * r1); 298f9f848faSopenharmony_ci RETURNI(t); 299f9f848faSopenharmony_ci } 300f9f848faSopenharmony_ci if (k == -1) { 301f9f848faSopenharmony_ci t = SUM2P(tbl[n2].hi - 2, tbl[n2].lo * (r1 + 1) + t * q + 302f9f848faSopenharmony_ci tbl[n2].hi * r1); 303f9f848faSopenharmony_ci RETURNI(t / 2); 304f9f848faSopenharmony_ci } 305f9f848faSopenharmony_ci if (k < -7) { 306f9f848faSopenharmony_ci t = SUM2P(tbl[n2].hi, tbl[n2].lo + t * (q + r1)); 307f9f848faSopenharmony_ci RETURNI(t * twopk - 1); 308f9f848faSopenharmony_ci } 309f9f848faSopenharmony_ci if (k > 2 * LDBL_MANT_DIG - 1) { 310f9f848faSopenharmony_ci t = SUM2P(tbl[n2].hi, tbl[n2].lo + t * (q + r1)); 311f9f848faSopenharmony_ci if (k == LDBL_MAX_EXP) 312f9f848faSopenharmony_ci RETURNI(t * 2 * 0x1p16383L - 1); 313f9f848faSopenharmony_ci RETURNI(t * twopk - 1); 314f9f848faSopenharmony_ci } 315f9f848faSopenharmony_ci 316f9f848faSopenharmony_ci v.xbits.expsign = BIAS - k; 317f9f848faSopenharmony_ci twomk = v.e; 318f9f848faSopenharmony_ci 319f9f848faSopenharmony_ci if (k > LDBL_MANT_DIG - 1) 320f9f848faSopenharmony_ci t = SUM2P(tbl[n2].hi, tbl[n2].lo - twomk + t * (q + r1)); 321f9f848faSopenharmony_ci else 322f9f848faSopenharmony_ci t = SUM2P(tbl[n2].hi - twomk, tbl[n2].lo + t * (q + r1)); 323f9f848faSopenharmony_ci RETURNI(t * twopk); 324f9f848faSopenharmony_ci} 325