Deleted Added
full compact
s_expl.c (251334) s_expl.c (251335)
1/*-
2 * Copyright (c) 2009-2013 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) 2009-2013 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 251334 2013-06-03 18:40:00Z kargl $");
28__FBSDID("$FreeBSD: head/lib/msun/ld128/s_expl.c 251335 2013-06-03 18:51:34Z kargl $");
29
30/*
31 * ld128 version of s_expl.c. See ../ld80/s_expl.c for most comments.
32 */
33
34#include <float.h>
35
36#include "fpmath.h"

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

229 uint32_t hx, ix;
230
231 /* Filter out exceptional cases. */
232 u.e = x;
233 hx = u.xbits.expsign;
234 ix = hx & 0x7fff;
235 if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */
236 if (ix == BIAS + LDBL_MAX_EXP) {
29
30/*
31 * ld128 version of s_expl.c. See ../ld80/s_expl.c for most comments.
32 */
33
34#include <float.h>
35
36#include "fpmath.h"

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

229 uint32_t hx, ix;
230
231 /* Filter out exceptional cases. */
232 u.e = x;
233 hx = u.xbits.expsign;
234 ix = hx & 0x7fff;
235 if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */
236 if (ix == BIAS + LDBL_MAX_EXP) {
237 if (hx & 0x8000 && u.xbits.manh == 0 &&
238 u.xbits.manl == 0)
239 return (0.0L); /* x is -Inf */
237 if (hx & 0x8000) /* x is -Inf or -NaN */
238 return (-1 / x);
240 return (x + x); /* x is +Inf or NaN */
241 }
242 if (x > o_threshold)
243 return (huge * huge);
244 if (x < u_threshold)
245 return (tiny * tiny);
239 return (x + x); /* x is +Inf or NaN */
240 }
241 if (x > o_threshold)
242 return (huge * huge);
243 if (x < u_threshold)
244 return (tiny * tiny);
246 } else if (ix < BIAS - 115) { /* |x| < 0x1p-115 */
247 if (huge + x > 1.0L) /* trigger inexact iff x != 0 */
248 return (1.0L + x);
245 } else if (ix < BIAS - 114) { /* |x| < 0x1p-114 */
246 return (1 + x); /* 1 with inexact iff x != 0 */
249 }
250
251 /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */
252 /* Use a specialized rint() to get fn. Assume round-to-nearest. */
253 /* XXX assume no extra precision for the additions, as for trig fns. */
254 /* XXX this set of comments is now quadruplicated. */
255 fn = (double)x * INV_L + 0x1.8p52 - 0x1.8p52;
256#if defined(HAVE_EFFICIENT_IRINT)

--- 36 unchanged lines hidden ---
247 }
248
249 /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */
250 /* Use a specialized rint() to get fn. Assume round-to-nearest. */
251 /* XXX assume no extra precision for the additions, as for trig fns. */
252 /* XXX this set of comments is now quadruplicated. */
253 fn = (double)x * INV_L + 0x1.8p52 - 0x1.8p52;
254#if defined(HAVE_EFFICIENT_IRINT)

--- 36 unchanged lines hidden ---