summaryrefslogtreecommitdiffstats
path: root/lib/msun
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2011-10-15 05:00:56 +0000
committerdas <das@FreeBSD.org>2011-10-15 05:00:56 +0000
commit915e8563c491314be373b178530a250e60c1219c (patch)
tree83e6faf395a676a00640f67327fd9fd18e75b740 /lib/msun
parent567164fbd4a50ce58378cb8d2f278ebb27f32ea2 (diff)
downloadFreeBSD-src-915e8563c491314be373b178530a250e60c1219c.zip
FreeBSD-src-915e8563c491314be373b178530a250e60c1219c.tar.gz
Style fixes and updates to comments.
Submitted by: bde
Diffstat (limited to 'lib/msun')
-rw-r--r--lib/msun/src/e_log10.c17
-rw-r--r--lib/msun/src/e_log10f.c16
-rw-r--r--lib/msun/src/e_log2.c17
-rw-r--r--lib/msun/src/e_log2f.c16
4 files changed, 34 insertions, 32 deletions
diff --git a/lib/msun/src/e_log10.c b/lib/msun/src/e_log10.c
index 135f0dc..ad0aed5 100644
--- a/lib/msun/src/e_log10.c
+++ b/lib/msun/src/e_log10.c
@@ -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;
diff --git a/lib/msun/src/e_log10f.c b/lib/msun/src/e_log10f.c
index 940b831..960b608 100644
--- a/lib/msun/src/e_log10f.c
+++ b/lib/msun/src/e_log10f.c
@@ -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;
diff --git a/lib/msun/src/e_log2.c b/lib/msun/src/e_log2.c
index 6cf3dbc..d237759 100644
--- a/lib/msun/src/e_log2.c
+++ b/lib/msun/src/e_log2.c
@@ -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;
diff --git a/lib/msun/src/e_log2f.c b/lib/msun/src/e_log2f.c
index bb308d3..ba63bc3 100644
--- a/lib/msun/src/e_log2f.c
+++ b/lib/msun/src/e_log2f.c
@@ -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;
OpenPOWER on IntegriCloud