Average Error: 36.7 → 21.7
Time: 9.0s
Precision: binary64
\[\tan \left(x + \varepsilon\right) - \tan x\]
\[\frac{\tan x + \tan \varepsilon}{1 - \log \left({\left(e^{\tan x}\right)}^{\tan \varepsilon}\right)} - \tan x\]
\tan \left(x + \varepsilon\right) - \tan x
\frac{\tan x + \tan \varepsilon}{1 - \log \left({\left(e^{\tan x}\right)}^{\tan \varepsilon}\right)} - \tan x
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
(FPCore (x eps)
 :precision binary64
 (-
  (/ (+ (tan x) (tan eps)) (- 1.0 (log (pow (exp (tan x)) (tan eps)))))
  (tan x)))
double code(double x, double eps) {
	return tan(x + eps) - tan(x);
}
double code(double x, double eps) {
	return ((tan(x) + tan(eps)) / (1.0 - log(pow(exp(tan(x)), tan(eps))))) - tan(x);
}

Error

Bits error versus x

Bits error versus eps

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original36.7
Target14.9
Herbie21.7
\[\frac{\sin \varepsilon}{\cos x \cdot \cos \left(x + \varepsilon\right)}\]

Derivation

  1. Initial program 36.7

    \[\tan \left(x + \varepsilon\right) - \tan x\]
  2. Using strategy rm
  3. Applied tan-sum_binary6421.7

    \[\leadsto \color{blue}{\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon}} - \tan x\]
  4. Using strategy rm
  5. Applied add-log-exp_binary6421.7

    \[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \color{blue}{\log \left(e^{\tan x \cdot \tan \varepsilon}\right)}} - \tan x\]
  6. Simplified21.7

    \[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \log \color{blue}{\left({\left(e^{\tan x}\right)}^{\tan \varepsilon}\right)}} - \tan x\]
  7. Final simplification21.7

    \[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \log \left({\left(e^{\tan x}\right)}^{\tan \varepsilon}\right)} - \tan x\]

Reproduce

herbie shell --seed 2020268 
(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)))