Print this page
@@ -121,11 +121,11 @@
#define Lp7 xxx[9]
#define zero xxx[10]
double
log1p(double x) {
- double hfsq, f, c, s, z, R, u;
+ double hfsq, f, c = 0.0, s, z, R, u;
int k, hx, hu, ax;
hx = ((int *)&x)[HIWORD]; /* high word of x */
ax = hx & 0x7fffffff;
@@ -150,10 +150,11 @@
k = 0;
f = x;
hu = 1;
}
}
+ /* We will initialize 'c' here. */
if (k != 0) {
if (hx < 0x43400000) {
u = 1.0 + x;
hu = ((int *)&u)[HIWORD]; /* high word of u */
k = (hu >> 20) - 1023;
@@ -181,10 +182,11 @@
hfsq = 0.5 * f * f;
if (hu == 0) { /* |f| < 2**-20 */
if (f == zero) {
if (k == 0)
return (zero);
+ /* We already initialized 'c' before, when (k != 0) */
c += k * ln2_lo;
return (k * ln2_hi + c);
}
R = hfsq * (1.0 - 0.66666666666666666 * f);
if (k == 0)