\frac{1}{x} - \frac{1}{\tan x}\log \left(e^{{x}^{5} \cdot \frac{2}{945}}\right) + \frac{x}{\frac{\frac{\frac{1}{3} - \frac{1}{45} \cdot \left(x \cdot x\right)}{\frac{1}{3} + \frac{1}{45} \cdot \left(x \cdot x\right)}}{\frac{1}{3} - \frac{1}{45} \cdot \left(x \cdot x\right)}}double f(double x) {
double r1249132 = 1.0;
double r1249133 = x;
double r1249134 = r1249132 / r1249133;
double r1249135 = tan(r1249133);
double r1249136 = r1249132 / r1249135;
double r1249137 = r1249134 - r1249136;
return r1249137;
}
double f(double x) {
double r1249138 = x;
double r1249139 = 5.0;
double r1249140 = pow(r1249138, r1249139);
double r1249141 = 0.0021164021164021165;
double r1249142 = r1249140 * r1249141;
double r1249143 = exp(r1249142);
double r1249144 = log(r1249143);
double r1249145 = 0.3333333333333333;
double r1249146 = 0.022222222222222223;
double r1249147 = r1249138 * r1249138;
double r1249148 = r1249146 * r1249147;
double r1249149 = r1249145 - r1249148;
double r1249150 = r1249145 + r1249148;
double r1249151 = r1249149 / r1249150;
double r1249152 = r1249151 / r1249149;
double r1249153 = r1249138 / r1249152;
double r1249154 = r1249144 + r1249153;
return r1249154;
}




Bits error versus x
Results
| Original | 60.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
Initial program 60.0
Taylor expanded around 0 0.4
Simplified0.4
rmApplied flip-+0.4
Applied associate-*r/0.3
rmApplied associate-/l*0.0
Simplified0.0
rmApplied add-log-exp0.0
Final simplification0.0
herbie shell --seed 2019154
(FPCore (x)
:name "invcot (example 3.9)"
: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))))