Average Error: 37.1 → 37.1
Time: 5.5s
Precision: binary64
Cost: 13120
\[\tan \left(x + \varepsilon\right) - \tan x\]
\[\tan \left(x + \varepsilon\right) - \tan x\]
\tan \left(x + \varepsilon\right) - \tan x
\tan \left(x + \varepsilon\right) - \tan x
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
double code(double x, double eps) {
	return tan(x + eps) - tan(x);
}
double code(double x, double eps) {
	return tan(x + 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

Original37.1
Target15.4
Herbie37.1
\[\frac{\sin \varepsilon}{\cos x \cdot \cos \left(x + \varepsilon\right)}\]

Derivation

  1. Initial program 37.1

    \[\tan \left(x + \varepsilon\right) - \tan x\]
  2. Simplified37.1

    \[\leadsto \color{blue}{\tan \left(x + \varepsilon\right) - \tan x}\]
  3. Final simplification37.1

    \[\leadsto \tan \left(x + \varepsilon\right) - \tan x\]

Reproduce

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