\frac{1}{x} - \frac{1}{\tan x}\log \left(e^{0.02222222222222222307030925492199457949027 \cdot {x}^{3}}\right) + \left(\log \left(e^{0.002116402116402116544841005563171165704262 \cdot {x}^{5}}\right) + 0.3333333333333333148296162562473909929395 \cdot x\right)double f(double x) {
double r78377 = 1.0;
double r78378 = x;
double r78379 = r78377 / r78378;
double r78380 = tan(r78378);
double r78381 = r78377 / r78380;
double r78382 = r78379 - r78381;
return r78382;
}
double f(double x) {
double r78383 = 0.022222222222222223;
double r78384 = x;
double r78385 = 3.0;
double r78386 = pow(r78384, r78385);
double r78387 = r78383 * r78386;
double r78388 = exp(r78387);
double r78389 = log(r78388);
double r78390 = 0.0021164021164021165;
double r78391 = 5.0;
double r78392 = pow(r78384, r78391);
double r78393 = r78390 * r78392;
double r78394 = exp(r78393);
double r78395 = log(r78394);
double r78396 = 0.3333333333333333;
double r78397 = r78396 * r78384;
double r78398 = r78395 + r78397;
double r78399 = r78389 + r78398;
return r78399;
}




Bits error versus x
Results
| Original | 60.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.5 |
Initial program 60.0
Taylor expanded around 0 0.3
rmApplied add-log-exp0.5
rmApplied add-log-exp0.5
Final simplification0.5
herbie shell --seed 2019305
(FPCore (x)
:name "invcot (example 3.9)"
:precision binary64
:pre (and (< -0.0259999999999999988 x) (< x 0.0259999999999999988))
:herbie-target
(if (< (fabs x) 0.0259999999999999988) (* (/ x 3) (+ 1 (/ (* x x) 15))) (- (/ 1 x) (/ 1 (tan x))))
(- (/ 1 x) (/ 1 (tan x))))