Style fixes and updates to comments.
Submitted by: bde
This commit is contained in:
parent
567164fbd4
commit
915e8563c4
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user