From owner-svn-src-head@FreeBSD.ORG Mon Jun 3 18:51:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C27036EE; Mon, 3 Jun 2013 18:51:35 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 99BDA1FC3; Mon, 3 Jun 2013 18:51:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53IpZkP022652; Mon, 3 Jun 2013 18:51:35 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53IpZle022650; Mon, 3 Jun 2013 18:51:35 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031851.r53IpZle022650@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 18:51:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251335 - in head/lib/msun: ld128 ld80 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jun 2013 18:51:35 -0000 Author: kargl Date: Mon Jun 3 18:51:34 2013 New Revision: 251335 URL: http://svnweb.freebsd.org/changeset/base/251335 Log: ld80/s_expl.c: * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.man. * Fix an off-by-one for small arguments |x| < 0x1p-65. ld128/s_expl.c: * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.manh and u.xbits.manl. * Fix an off-by-one for small arguments |x| < 0x1p-114. Obtained from: bde Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jun 3 18:40:00 2013 (r251334) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 18:51:34 2013 (r251335) @@ -234,18 +234,16 @@ expl(long double x) ix = hx & 0x7fff; if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { - if (hx & 0x8000 && u.xbits.manh == 0 && - u.xbits.manl == 0) - return (0.0L); /* x is -Inf */ + if (hx & 0x8000) /* x is -Inf or -NaN */ + return (-1 / x); return (x + x); /* x is +Inf or NaN */ } if (x > o_threshold) return (huge * huge); if (x < u_threshold) return (tiny * tiny); - } else if (ix < BIAS - 115) { /* |x| < 0x1p-115 */ - if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ - return (1.0L + x); + } else if (ix < BIAS - 114) { /* |x| < 0x1p-114 */ + return (1 + x); /* 1 with inexact iff x != 0 */ } /* Reduce x to (k*ln2 + endpoint[n2] + r1 + r2). */ Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 18:40:00 2013 (r251334) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 18:51:34 2013 (r251335) @@ -246,18 +246,16 @@ expl(long double x) ix = hx & 0x7fff; if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { - if (hx & 0x8000 && u.xbits.man == 1ULL << 63) - return (0.0L); /* x is -Inf */ - return (x + x); /* x is +Inf, NaN or unsupported */ + if (hx & 0x8000) /* x is -Inf, -NaN or unsupported */ + return (-1 / x); + return (x + x); /* x is +Inf, +NaN or unsupported */ } if (x > o_threshold) return (huge * huge); if (x < u_threshold) return (tiny * tiny); - } else if (ix < BIAS - 66) { /* |x| < 0x1p-66 */ - /* includes pseudo-denormals */ - if (huge + x > 1.0L) /* trigger inexact iff x != 0 */ - return (1.0L + x); + } else if (ix < BIAS - 65) { /* |x| < 0x1p-65 (includes pseudos) */ + return (1 + x); /* 1 with inexact iff x != 0 */ } ENTERI();