Style fixes and updates to comments.

Submitted by:	bde
This commit is contained in:
David Schultz 2011-10-15 05:00:56 +00:00
parent 15d5d9deb1
commit 5ebf26f6a1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226375
4 changed files with 34 additions and 32 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;