From owner-svn-src-head@FreeBSD.ORG Mon Jun 3 17:36:27 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 9671A918; Mon, 3 Jun 2013 17:36:27 +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 874441C5F; Mon, 3 Jun 2013 17:36:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r53HaRMf093350; Mon, 3 Jun 2013 17:36:27 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r53HaQ8R093348; Mon, 3 Jun 2013 17:36:26 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201306031736.r53HaQ8R093348@svn.freebsd.org> From: Steve Kargl Date: Mon, 3 Jun 2013 17:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251321 - 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 17:36:27 -0000 Author: kargl Date: Mon Jun 3 17:36:26 2013 New Revision: 251321 URL: http://svnweb.freebsd.org/changeset/base/251321 Log: * Rename the polynomial coefficients from P2, P3, ... to A2, A3, .... The names now coincide with the name used in PTP Tang's paper. * Rename the variable from s to tbl to better reflect that this is a table, and to be consistent with the naming scheme in s_exp2l.c Reviewed by: bde (as part of larger diff) 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 17:34:48 2013 (r251320) +++ head/lib/msun/ld128/s_expl.c Mon Jun 3 17:36:26 2013 (r251321) @@ -52,21 +52,21 @@ twom10000 = 0x1p-10000L, u_threshold = -11433.462743336297878837243843452621503L; static const long double -P2 = 5.00000000000000000000000000000000000e-1L, -P3 = 1.66666666666666666666666666666666972e-1L, -P4 = 4.16666666666666666666666666653708268e-2L, -P5 = 8.33333333333333333333333315069867254e-3L, -P6 = 1.38888888888888888888996596213795377e-3L, -P7 = 1.98412698412698412718821436278644414e-4L, -P8 = 2.48015873015869681884882576649543128e-5L, -P9 = 2.75573192240103867817876199544468806e-6L, -P10 = 2.75573236172670046201884000197885520e-7L, -P11 = 2.50517544183909126492878226167697856e-8L; +A2 = 5.00000000000000000000000000000000000e-1L, +A3 = 1.66666666666666666666666666666666972e-1L, +A4 = 4.16666666666666666666666666653708268e-2L, +A5 = 8.33333333333333333333333315069867254e-3L, +A6 = 1.38888888888888888888996596213795377e-3L, +A7 = 1.98412698412698412718821436278644414e-4L, +A8 = 2.48015873015869681884882576649543128e-5L, +A9 = 2.75573192240103867817876199544468806e-6L, +A10 = 2.75573236172670046201884000197885520e-7L, +A11 = 2.50517544183909126492878226167697856e-8L; static const struct { long double hi; long double lo; -} s[INTERVALS] = { +} tbl[INTERVALS] = { 0x1p0L, 0x0p0L, 0x1.0163da9fb33356d84a66aep0L, 0x3.36dcdfa4003ec04c360be2404078p-92L, 0x1.02c9a3e778060ee6f7cacap0L, 0x4.f7a29bde93d70a2cabc5cb89ba10p-92L, @@ -245,10 +245,10 @@ expl(long double x) } r = r1 + r2; - q = r * r * (P2 + r * (P3 + r * (P4 + r * (P5 + r * (P6 + r * (P7 + - r * (P8 + r * (P9 + r * (P10 + r * P11))))))))); - t = s[n2].lo + s[n2].hi; - t = s[n2].hi + (s[n2].lo + t * (r2 + q + r1)); + q = r * r * (A2 + r * (A3 + r * (A4 + r * (A5 + r * (A6 + r * (A7 + + r * (A8 + r * (A9 + r * (A10 + r * A11))))))))); + t = tbl[n2].lo + tbl[n2].hi; + t = tbl[n2].hi + (tbl[n2].lo + t * (r2 + q + r1)); /* Scale by 2**k. */ if (k >= LDBL_MIN_EXP) { Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jun 3 17:34:48 2013 (r251320) +++ head/lib/msun/ld80/s_expl.c Mon Jun 3 17:36:26 2013 (r251321) @@ -78,11 +78,11 @@ L2 = -3.2819649005320973e-13, /* -0x171 * |exp(x) - p(x)| < 2**-77.2 * (0.002708 is ln2/(2*INTERVALS) rounded up a little). */ -P2 = 0.5, -P3 = 1.6666666666666119e-1, /* 0x15555555555490.0p-55 */ -P4 = 4.1666666666665887e-2, /* 0x155555555554e5.0p-57 */ -P5 = 8.3333354987869413e-3, /* 0x1111115b789919.0p-59 */ -P6 = 1.3888891738560272e-3; /* 0x16c16c651633ae.0p-62 */ +A2 = 0.5, +A3 = 1.6666666666666119e-1, /* 0x15555555555490.0p-55 */ +A4 = 4.1666666666665887e-2, /* 0x155555555554e5.0p-57 */ +A5 = 8.3333354987869413e-3, /* 0x1111115b789919.0p-59 */ +A6 = 1.3888891738560272e-3; /* 0x16c16c651633ae.0p-62 */ /* * 2^(i/INTERVALS) for i in [0,INTERVALS] is represented by two values where @@ -96,8 +96,7 @@ P6 = 1.3888891738560272e-3; /* 0x16c1 static const struct { double hi; double lo; -/* XXX should rename 's'. */ -} s[INTERVALS] = { +} tbl[INTERVALS] = { 0x1p+0, 0x0p+0, 0x1.0163da9fb3335p+0, 0x1.b61299ab8cdb7p-54, 0x1.02c9a3e778060p+0, 0x1.dcdef95949ef4p-53, @@ -284,14 +283,14 @@ expl(long double x) twopkp10000 = v.e; } - /* Evaluate expl(midpoint[n2] + r1 + r2) = s[n2] * expl(r1 + r2). */ + /* Evaluate expl(midpoint[n2] + r1 + r2) = tbl[n2] * expl(r1 + r2). */ /* Here q = q(r), not q(r1), since r1 is lopped like L1. */ t45 = r * P5 + P4; z = r * r; t23 = r * P3 + P2; q = r2 + z * t23 + z * z * t45 + z * z * z * P6; - t = (long double)s[n2].lo + s[n2].hi; - t = s[n2].lo + t * (q + r1) + s[n2].hi; + t = (long double)tbl[n2].lo + tbl[n2].hi; + t = tbl[n2].lo + t * (q + r1) + tbl[n2].hi; /* Scale by 2**k. */ if (k >= LDBL_MIN_EXP) {