\tan \left(x + \varepsilon\right) - \tan x
\frac{\frac{\sin \varepsilon}{\cos \varepsilon} \cdot \left(\cos x + \frac{\log \left(e^{{\sin x}^{2}}\right)}{\cos x}\right)}{\cos x \cdot \left(1 - \tan x \cdot \tan \varepsilon\right)}(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
(FPCore (x eps) :precision binary64 (/ (* (/ (sin eps) (cos eps)) (+ (cos x) (/ (log (exp (pow (sin x) 2.0))) (cos x)))) (* (cos x) (- 1.0 (* (tan x) (tan eps))))))
double code(double x, double eps) {
return tan(x + eps) - tan(x);
}
double code(double x, double eps) {
return ((sin(eps) / cos(eps)) * (cos(x) + (log(exp(pow(sin(x), 2.0))) / cos(x)))) / (cos(x) * (1.0 - (tan(x) * tan(eps))));
}




Bits error versus x




Bits error versus eps
Results
| Original | 37.0 |
|---|---|
| Target | 15.3 |
| Herbie | 0.5 |
Initial program 37.0
rmApplied tan-quot_binary6437.0
Applied tan-sum_binary6421.8
Applied frac-sub_binary6421.8
Taylor expanded around inf 0.4
Simplified0.4
rmApplied add-log-exp_binary640.5
Final simplification0.5
herbie shell --seed 2020232
(FPCore (x eps)
:name "2tan (problem 3.3.2)"
:precision binary64
:herbie-target
(/ (sin eps) (* (cos x) (cos (+ x eps))))
(- (tan (+ x eps)) (tan x)))