Deleted Added
full compact
s_expl.c (238783) s_expl.c (238784)
1/*-
2 * Copyright (c) 2012 Steven G. Kargl
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2012 Steven G. Kargl
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/msun/ld128/s_expl.c 238783 2012-07-26 03:59:33Z kargl $");
28__FBSDID("$FreeBSD: head/lib/msun/ld128/s_expl.c 238784 2012-07-26 04:05:08Z kargl $");
29
30#include <float.h>
31
32#include "fpmath.h"
33#include "math.h"
34#include "math_private.h"
35
36#define BIAS (LDBL_MAX_EXP - 1)
37
29
30#include <float.h>
31
32#include "fpmath.h"
33#include "math.h"
34#include "math_private.h"
35
36#define BIAS (LDBL_MAX_EXP - 1)
37
38/* XXX Prevent gcc from erroneously constant folding this: */
38static volatile const long double twom10000 = 0x1p-10000L, tiny = 0x1p-10000L;
39
40static const long double
41huge = 0x1p10000L,
42o_threshold = 11356.523406294143949491931077970763428L,
43u_threshold = -11433.462743336297878837243843452621503L,
44L1 = 5.41521234812457272982212595914567508e-03L,
45L2 = -1.02536706388947310094527932552595546e-29L,

--- 6 unchanged lines hidden (view full) ---

52P5 = 8.33333333333333333333333315069867254e-3L,
53P6 = 1.38888888888888888888996596213795377e-3L,
54P7 = 1.98412698412698412718821436278644414e-4L,
55P8 = 2.48015873015869681884882576649543128e-5L,
56P9 = 2.75573192240103867817876199544468806e-6L,
57P10 = 2.75573236172670046201884000197885520e-7L,
58P11 = 2.50517544183909126492878226167697856e-8L;
59
39static volatile const long double twom10000 = 0x1p-10000L, tiny = 0x1p-10000L;
40
41static const long double
42huge = 0x1p10000L,
43o_threshold = 11356.523406294143949491931077970763428L,
44u_threshold = -11433.462743336297878837243843452621503L,
45L1 = 5.41521234812457272982212595914567508e-03L,
46L2 = -1.02536706388947310094527932552595546e-29L,

--- 6 unchanged lines hidden (view full) ---

53P5 = 8.33333333333333333333333315069867254e-3L,
54P6 = 1.38888888888888888888996596213795377e-3L,
55P7 = 1.98412698412698412718821436278644414e-4L,
56P8 = 2.48015873015869681884882576649543128e-5L,
57P9 = 2.75573192240103867817876199544468806e-6L,
58P10 = 2.75573236172670046201884000197885520e-7L,
59P11 = 2.50517544183909126492878226167697856e-8L;
60
60#define NUM 128
61#define INTERVALS 128
61
62static const struct {
63 long double hi;
64 long double lo;
62
63static const struct {
64 long double hi;
65 long double lo;
65} s[NUM] = {
66} s[INTERVALS] = {
66 0x1p0L, 0x0p0L,
67 0x1.0163da9fb33356d84a66aep0L, 0x3.36dcdfa4003ec04c360be2404078p-92L,
68 0x1.02c9a3e778060ee6f7cacap0L, 0x4.f7a29bde93d70a2cabc5cb89ba10p-92L,
69 0x1.04315e86e7f84bd738f9a2p0L, 0xd.a47e6ed040bb4bfc05af6455e9b8p-96L,
70 0x1.059b0d31585743ae7c548ep0L, 0xb.68ca417fe53e3495f7df4baf84a0p-92L,
71 0x1.0706b29ddf6ddc6dc403a8p0L, 0x1.d87b27ed07cb8b092ac75e311753p-88L,
72 0x1.0874518759bc808c35f25cp0L, 0x1.9427fa2b041b2d6829d8993a0d01p-88L,
73 0x1.09e3ecac6f3834521e060cp0L, 0x5.84d6b74ba2e023da730e7fccb758p-92L,

--- 147 unchanged lines hidden (view full) ---

221 } else if (ix <= BIAS - 115) { /* |x| < 0x1p-33 */
222 /* includes pseudo-denormals */
223 if (huge + x > 1.0L) /* trigger inexact iff x != 0 */
224 return (1.0L + x);
225 }
226
227 fn = x * INV_L + 0x1.8p112 - 0x1.8p112;
228 n = (int)fn;
67 0x1p0L, 0x0p0L,
68 0x1.0163da9fb33356d84a66aep0L, 0x3.36dcdfa4003ec04c360be2404078p-92L,
69 0x1.02c9a3e778060ee6f7cacap0L, 0x4.f7a29bde93d70a2cabc5cb89ba10p-92L,
70 0x1.04315e86e7f84bd738f9a2p0L, 0xd.a47e6ed040bb4bfc05af6455e9b8p-96L,
71 0x1.059b0d31585743ae7c548ep0L, 0xb.68ca417fe53e3495f7df4baf84a0p-92L,
72 0x1.0706b29ddf6ddc6dc403a8p0L, 0x1.d87b27ed07cb8b092ac75e311753p-88L,
73 0x1.0874518759bc808c35f25cp0L, 0x1.9427fa2b041b2d6829d8993a0d01p-88L,
74 0x1.09e3ecac6f3834521e060cp0L, 0x5.84d6b74ba2e023da730e7fccb758p-92L,

--- 147 unchanged lines hidden (view full) ---

222 } else if (ix <= BIAS - 115) { /* |x| < 0x1p-33 */
223 /* includes pseudo-denormals */
224 if (huge + x > 1.0L) /* trigger inexact iff x != 0 */
225 return (1.0L + x);
226 }
227
228 fn = x * INV_L + 0x1.8p112 - 0x1.8p112;
229 n = (int)fn;
229 n2 = (unsigned)n % NUM; /* Tang's j. */
230 k = (n - n2) / NUM;
230 n2 = (unsigned)n % INTERVALS; /* Tang's j. */
231 k = (n - n2) / INTERVALS;
231 r1 = x - fn * L1;
232 r2 = -fn * L2;
233
234 /* Prepare scale factors. */
235 v.xbits.manh = 0;
236 v.xbits.manl = 0;
237 if (k >= LDBL_MIN_EXP) {
238 v.xbits.expsign = BIAS + k;

--- 21 unchanged lines hidden ---
232 r1 = x - fn * L1;
233 r2 = -fn * L2;
234
235 /* Prepare scale factors. */
236 v.xbits.manh = 0;
237 v.xbits.manl = 0;
238 if (k >= LDBL_MIN_EXP) {
239 v.xbits.expsign = BIAS + k;

--- 21 unchanged lines hidden ---