Average Error: 36.9 → 14.5
Time: 59.9s
Precision: 64
Internal Precision: 2432
\[\tan \left(x + \varepsilon\right) - \tan x\]
\[\begin{array}{l} \mathbf{if}\;\varepsilon \le -1.258236075558796 \cdot 10^{-22}:\\ \;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \sqrt[3]{{\left(\tan \varepsilon \cdot \tan x\right)}^{3}}} - \tan x\\ \mathbf{if}\;\varepsilon \le 1.1923581062102226 \cdot 10^{-37}:\\ \;\;\;\;\varepsilon + \left({\varepsilon}^{3} \cdot {x}^{2} + {\varepsilon}^{2} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \sqrt[3]{{\left(\tan \varepsilon \cdot \tan x\right)}^{3}}} - \tan x\\ \end{array}\]

Error

Bits error versus x

Bits error versus eps

Target

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

Derivation

  1. Split input into 2 regimes
  2. if eps < -1.258236075558796e-22 or 1.1923581062102226e-37 < eps

    1. Initial program 29.2

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

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

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

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

    if -1.258236075558796e-22 < eps < 1.1923581062102226e-37

    1. Initial program 46.3

      \[\tan \left(x + \varepsilon\right) - \tan x\]
    2. Taylor expanded around 0 29.8

      \[\leadsto \color{blue}{\varepsilon + \left({\varepsilon}^{3} \cdot {x}^{2} + {\varepsilon}^{2} \cdot x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 59.9s)Debug logProfile

herbie shell --seed '#(1063313015 2771194459 1594909340 1344785158 2223560818 546365448)' 
(FPCore (x eps)
  :name "2tan (problem 3.3.2)"
  :herbie-expected 28

  :herbie-target
  (/ (sin eps) (* (cos x) (cos (+ x eps))))

  (- (tan (+ x eps)) (tan x)))