\frac{1}{x} - \frac{1}{\tan x}\left(0.0222222222222222231 \cdot {x}^{3} + 0.00211640211640211654 \cdot {x}^{5}\right) + 0.333333333333333315 \cdot xdouble f(double x) {
double r124738 = 1.0;
double r124739 = x;
double r124740 = r124738 / r124739;
double r124741 = tan(r124739);
double r124742 = r124738 / r124741;
double r124743 = r124740 - r124742;
return r124743;
}
double f(double x) {
double r124744 = 0.022222222222222223;
double r124745 = x;
double r124746 = 3.0;
double r124747 = pow(r124745, r124746);
double r124748 = r124744 * r124747;
double r124749 = 0.0021164021164021165;
double r124750 = 5.0;
double r124751 = pow(r124745, r124750);
double r124752 = r124749 * r124751;
double r124753 = r124748 + r124752;
double r124754 = 0.3333333333333333;
double r124755 = r124754 * r124745;
double r124756 = r124753 + r124755;
return r124756;
}




Bits error versus x
Results
| Original | 59.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
Initial program 59.8
Taylor expanded around 0 0.3
rmApplied associate-+r+0.3
Final simplification0.3
herbie shell --seed 2020081
(FPCore (x)
:name "invcot (example 3.9)"
:precision binary64
:pre (and (< -0.026 x) (< x 0.026))
:herbie-target
(if (< (fabs x) 0.026) (* (/ x 3) (+ 1 (/ (* x x) 15))) (- (/ 1 x) (/ 1 (tan x))))
(- (/ 1 x) (/ 1 (tan x))))