Date: Sat, 15 Oct 2011 05:00:56 +0000 (UTC) From: David Schultz <das@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r226375 - head/lib/msun/src Message-ID: <201110150500.p9F50ubA095989@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: das Date: Sat Oct 15 05:00:56 2011 New Revision: 226375 URL: http://svn.freebsd.org/changeset/base/226375 Log: Style fixes and updates to comments. Submitted by: bde Modified: head/lib/msun/src/e_log10.c head/lib/msun/src/e_log10f.c head/lib/msun/src/e_log2.c head/lib/msun/src/e_log2f.c Modified: head/lib/msun/src/e_log10.c ============================================================================== --- head/lib/msun/src/e_log10.c Sat Oct 15 04:24:54 2011 (r226374) +++ head/lib/msun/src/e_log10.c Sat Oct 15 05:00:56 2011 (r226375) @@ -15,7 +15,8 @@ __FBSDID("$FreeBSD$"); /* - * Return the base 10 logarithm of x. See k_log.c for details on the algorithm. + * Return the base 10 logarithm of x. See e_log.c and k_log.h for most + * comments. */ #include "math.h" @@ -40,14 +41,14 @@ __ieee754_log10(double x) EXTRACT_WORDS(hx,lx,x); - k=0; - if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx&0x7fffffff)|lx)==0) - return -two54/zero; /* log(+-0)=-inf */ - if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ - k -= 54; x *= two54; /* subnormal number, scale up x */ + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD(hx,x); - } + } if (hx >= 0x7ff00000) return x+x; k += (hx>>20)-1023; hx &= 0x000fffff; Modified: head/lib/msun/src/e_log10f.c ============================================================================== --- head/lib/msun/src/e_log10f.c Sat Oct 15 04:24:54 2011 (r226374) +++ head/lib/msun/src/e_log10f.c Sat Oct 15 05:00:56 2011 (r226375) @@ -13,7 +13,7 @@ __FBSDID("$FreeBSD$"); /* - * Return the base 10 logarithm of x. See k_log.c for details on the algorithm. + * Float version of e_log10.c. See the latter for most comments. */ #include "math.h" @@ -37,14 +37,14 @@ __ieee754_log10f(float x) GET_FLOAT_WORD(hx,x); - k=0; - if (hx < 0x00800000) { /* x < 2**-126 */ - if ((hx&0x7fffffff)==0) - return -two25/zero; /* log(+-0)=-inf */ - if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ - k -= 25; x *= two25; /* subnormal number, scale up x */ + k=0; + if (hx < 0x00800000) { /* x < 2**-126 */ + if ((hx&0x7fffffff)==0) + return -two25/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 25; x *= two25; /* subnormal number, scale up x */ GET_FLOAT_WORD(hx,x); - } + } if (hx >= 0x7f800000) return x+x; k += (hx>>23)-127; hx &= 0x007fffff; Modified: head/lib/msun/src/e_log2.c ============================================================================== --- head/lib/msun/src/e_log2.c Sat Oct 15 04:24:54 2011 (r226374) +++ head/lib/msun/src/e_log2.c Sat Oct 15 05:00:56 2011 (r226375) @@ -15,7 +15,8 @@ __FBSDID("$FreeBSD$"); /* - * Return the base 2 logarithm of x. See k_log.c for details on the algorithm. + * Return the base 2 logarithm of x. See e_log.c and k_log.h for most + * comments. */ #include "math.h" @@ -38,14 +39,14 @@ __ieee754_log2(double x) EXTRACT_WORDS(hx,lx,x); - k=0; - if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx&0x7fffffff)|lx)==0) - return -two54/zero; /* log(+-0)=-inf */ - if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ - k -= 54; x *= two54; /* subnormal number, scale up x */ + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD(hx,x); - } + } if (hx >= 0x7ff00000) return x+x; k += (hx>>20)-1023; hx &= 0x000fffff; Modified: head/lib/msun/src/e_log2f.c ============================================================================== --- head/lib/msun/src/e_log2f.c Sat Oct 15 04:24:54 2011 (r226374) +++ head/lib/msun/src/e_log2f.c Sat Oct 15 05:00:56 2011 (r226375) @@ -13,7 +13,7 @@ __FBSDID("$FreeBSD$"); /* - * Return the base 2 logarithm of x. See k_log.c for details on the algorithm. + * Float version of e_log2.c. See the latter for most comments. */ #include "math.h" @@ -35,14 +35,14 @@ __ieee754_log2f(float x) GET_FLOAT_WORD(hx,x); - k=0; - if (hx < 0x00800000) { /* x < 2**-126 */ - if ((hx&0x7fffffff)==0) - return -two25/zero; /* log(+-0)=-inf */ - if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ - k -= 25; x *= two25; /* subnormal number, scale up x */ + k=0; + if (hx < 0x00800000) { /* x < 2**-126 */ + if ((hx&0x7fffffff)==0) + return -two25/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 25; x *= two25; /* subnormal number, scale up x */ GET_FLOAT_WORD(hx,x); - } + } if (hx >= 0x7f800000) return x+x; k += (hx>>23)-127; hx &= 0x007fffff;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110150500.p9F50ubA095989>