Average Error: 36.9 → 0.6
Time: 5.5s
Precision: binary64
\[\tan \left(x + \varepsilon\right) - \tan x\]
\[\frac{\frac{\sin \varepsilon \cdot \cos x}{\cos \varepsilon} - \sin x \cdot \left(\left(-{\left(\sqrt[3]{\tan x}\right)}^{3}\right) \cdot \tan \varepsilon\right)}{\left(\cos x \cdot \left(-1 \cdot \tan x\right)\right) \cdot \tan \varepsilon + \cos x}\]

Error

Bits error versus x

Bits error versus eps

Target

Original36.9
Target15.1
Herbie0.6
\[\frac{\sin \varepsilon}{\cos x \cdot \cos \left(x + \varepsilon\right)}\]

Derivation

  1. Initial program 36.9

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

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

    \[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \color{blue}{\left(\left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right) \cdot \sqrt[3]{\tan x}\right)} \cdot \tan \varepsilon} - \tan x\]
  6. Applied associate-*l*21.9

    \[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \color{blue}{\left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right) \cdot \left(\sqrt[3]{\tan x} \cdot \tan \varepsilon\right)}} - \tan x\]
  7. Using strategy rm
  8. Applied tan-quot22.0

    \[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right) \cdot \left(\sqrt[3]{\tan x} \cdot \tan \varepsilon\right)} - \color{blue}{\frac{\sin x}{\cos x}}\]
  9. Applied frac-sub22.0

    \[\leadsto \color{blue}{\frac{\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \left(1 - \left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right) \cdot \left(\sqrt[3]{\tan x} \cdot \tan \varepsilon\right)\right) \cdot \sin x}{\left(1 - \left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right) \cdot \left(\sqrt[3]{\tan x} \cdot \tan \varepsilon\right)\right) \cdot \cos x}}\]
  10. Simplified20.7

    \[\leadsto \frac{\color{blue}{\left(\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \sin x\right) - \sin x \cdot \left(\left(-{\left(\sqrt[3]{\tan x}\right)}^{3}\right) \cdot \tan \varepsilon\right)}}{\left(1 - \left(\sqrt[3]{\tan x} \cdot \sqrt[3]{\tan x}\right) \cdot \left(\sqrt[3]{\tan x} \cdot \tan \varepsilon\right)\right) \cdot \cos x}\]
  11. Simplified20.7

    \[\leadsto \frac{\left(\left(\tan x + \tan \varepsilon\right) \cdot \cos x - \sin x\right) - \sin x \cdot \left(\left(-{\left(\sqrt[3]{\tan x}\right)}^{3}\right) \cdot \tan \varepsilon\right)}{\color{blue}{\left(\cos x \cdot \left(-1 \cdot \tan x\right)\right) \cdot \tan \varepsilon + \cos x}}\]
  12. Taylor expanded around inf 0.6

    \[\leadsto \frac{\color{blue}{\frac{\sin \varepsilon \cdot \cos x}{\cos \varepsilon}} - \sin x \cdot \left(\left(-{\left(\sqrt[3]{\tan x}\right)}^{3}\right) \cdot \tan \varepsilon\right)}{\left(\cos x \cdot \left(-1 \cdot \tan x\right)\right) \cdot \tan \varepsilon + \cos x}\]
  13. Final simplification0.6

    \[\leadsto \frac{\frac{\sin \varepsilon \cdot \cos x}{\cos \varepsilon} - \sin x \cdot \left(\left(-{\left(\sqrt[3]{\tan x}\right)}^{3}\right) \cdot \tan \varepsilon\right)}{\left(\cos x \cdot \left(-1 \cdot \tan x\right)\right) \cdot \tan \varepsilon + \cos x}\]

Reproduce

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