Lines Matching +full:error +full:- +full:correction

20  *	may not be representable exactly. In that case, a correction
21 * term is need. Let u=1+x rounded. Let c = (1+x)-u, then
22 * log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),
23 * and add back the correction term c/u.
27 * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
31 * a polynomial of degree 14 to approximate R The maximum error
32 * of this polynomial approximation is bounded by 2**-58.45. In
38 * | 2 14 | -58.45
39 * | Lp1*s +...+Lp7*s - R(z) | <= 2
41 * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
42 * In order to guarantee error in log below 1ulp, we compute log
44 * log1p(f) = f - (hfsq - s*(hfsq+R)).
47 * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
53 * log1p(x) is NaN with signal if x < -1 (including -INF) ;
54 * log1p(+INF) is +INF; log1p(-1) is -INF with signal;
58 * according to an error analysis, the error is always less than
72 * return log(u)*(x/(u-1.0));
74 * See HP-15C Advanced Functions Handbook, p.193.
83 ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
84 ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
86 Lp1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
87 Lp2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
88 Lp3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */
89 Lp4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
90 Lp5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
91 Lp6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
92 Lp7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
108 if(ax>=0x3ff00000) { /* x <= -1.0 */ in log1p()
109 if(x==-1.0) return -two54/vzero; /* log1p(-1)=+inf */ in log1p()
110 else return (x-x)/(x-x); /* log1p(x<-1)=NaN */ in log1p()
112 if(ax<0x3e200000) { /* |x| < 2**-29 */ in log1p()
114 &&ax<0x3c900000) /* |x| < 2**-54 */ in log1p()
117 return x - x*x*0.5; in log1p()
120 k=0;f=x;hu=1;} /* sqrt(2)/2- <= 1+x < sqrt(2)+ */ in log1p()
127 k = (hu>>20)-1023; in log1p()
128 c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ in log1p()
133 k = (hu>>20)-1023; in log1p()
142 * using the correction term but don't use it if k==0. in log1p()
149 hu = (0x00100000-hu)>>2; in log1p()
151 f = u-1.0; in log1p()
154 if(hu==0) { /* |f| < 2**-20 */ in log1p()
163 R = hfsq*(1.0-0.66666666666666666*f); in log1p()
164 if(k==0) return f-R; else in log1p()
165 return k*ln2_hi-((R-(k*ln2_lo+c))-f); in log1p()
170 if(k==0) return f-(hfsq-s*(hfsq+R)); else in log1p()
171 return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); in log1p()