Date: Mon, 21 Jan 2019 14:54:01 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r343257 - stable/11/lib/msun/src Message-ID: <201901211454.x0LEs1Mq099913@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon Jan 21 14:54:01 2019 New Revision: 343257 URL: https://svnweb.freebsd.org/changeset/base/343257 Log: MFC r343023: msun: reduce diff between src/e_j0.c and src/e_j0f.c PR: 229501 Modified: stable/11/lib/msun/src/e_j0.c stable/11/lib/msun/src/e_j0f.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/msun/src/e_j0.c ============================================================================== --- stable/11/lib/msun/src/e_j0.c Mon Jan 21 14:52:48 2019 (r343256) +++ stable/11/lib/msun/src/e_j0.c Mon Jan 21 14:54:01 2019 (r343257) @@ -80,7 +80,7 @@ S02 = 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xD S03 = 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */ S04 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */ -static const double zero = 0.0; +static const double zero = 0, qrtr = 0.25; double __ieee754_j0(double x) @@ -97,7 +97,7 @@ __ieee754_j0(double x) c = cos(x); ss = s-c; cc = s+c; - if(ix<0x7fe00000) { /* make sure x+x not overflow */ + if(ix<0x7fe00000) { /* Make sure x+x does not overflow. */ z = -cos(x+x); if ((s*c)<zero) cc = z/ss; else ss = z/cc; @@ -123,9 +123,9 @@ __ieee754_j0(double x) r = z*(R02+z*(R03+z*(R04+z*R05))); s = one+z*(S01+z*(S02+z*(S03+z*S04))); if(ix < 0x3FF00000) { /* |x| < 1.00 */ - return one + z*(-0.25+(r/s)); + return one + z*((r/s)-qrtr); } else { - u = 0.5*x; + u = x/2; return((one+u)*(one-u)+z*(r/s)); } } @@ -374,6 +374,7 @@ static const double qS2[6] = { static __inline double qzero(double x) { + static const double eighth = 0.125; const double *p,*q; double s,r,z; int32_t ix; @@ -386,5 +387,5 @@ qzero(double x) z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); - return (-.125 + r/s)/x; + return (r/s-eighth)/x; } Modified: stable/11/lib/msun/src/e_j0f.c ============================================================================== --- stable/11/lib/msun/src/e_j0f.c Mon Jan 21 14:52:48 2019 (r343256) +++ stable/11/lib/msun/src/e_j0f.c Mon Jan 21 14:54:01 2019 (r343257) @@ -42,7 +42,7 @@ S02 = 1.1692678527e-04, /* 0x38f53697 */ S03 = 5.1354652442e-07, /* 0x3509daa6 */ S04 = 1.1661400734e-09; /* 0x30a045e8 */ -static const float zero = 0.0; +static const float zero = 0, qrtr = 0.25; float __ieee754_j0f(float x) @@ -59,7 +59,7 @@ __ieee754_j0f(float x) c = cosf(x); ss = s-c; cc = s+c; - if(ix<0x7f000000) { /* make sure x+x not overflow */ + if(ix<0x7f000000) { /* Make sure x+x does not overflow. */ z = -cosf(x+x); if ((s*c)<zero) cc = z/ss; else ss = z/cc; @@ -85,9 +85,9 @@ __ieee754_j0f(float x) r = z*(R02+z*(R03+z*(R04+z*R05))); s = one+z*(S01+z*(S02+z*(S03+z*S04))); if(ix < 0x3F800000) { /* |x| < 1.00 */ - return one + z*((float)-0.25+(r/s)); + return one + z*((r/s)-qrtr); } else { - u = (float)0.5*x; + u = x/2; return((one+u)*(one-u)+z*(r/s)); } } @@ -328,6 +328,7 @@ static const float qS2[6] = { static __inline float qzerof(float x) { + static const float eighth = 0.125; const float *p,*q; float s,r,z; int32_t ix; @@ -340,5 +341,5 @@ qzerof(float x) z = one/(x*x); r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); - return (-(float).125 + r/s)/x; + return (r/s-eighth)/x; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901211454.x0LEs1Mq099913>