Average Error: 36.7 → 8.7
Time: 50.0s
Precision: 64
Internal precision: 2176
\[\tan \left(x + \varepsilon\right) - \tan x\]
\[\begin{array}{l} \mathbf{if}\;\varepsilon \le -2.1454937753948827 \cdot 10^{-23}:\\ \;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \sqrt[3]{{\left(\tan x\right)}^{3} \cdot {\left(\tan \varepsilon\right)}^{3}}} - \tan x\\ \mathbf{if}\;\varepsilon \le 6.683176783612011 \cdot 10^{-65}:\\ \;\;\;\;\varepsilon + \left({\varepsilon}^{3} \cdot {x}^{2} + {\varepsilon}^{2} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \sqrt[3]{{\left(\tan x\right)}^{3} \cdot {\left(\tan \varepsilon\right)}^{3}}} - \tan x\\ \end{array}\]

Error

Bits error versus x

Bits error versus eps

Target

Original36.7
Comparison27.0
Herbie8.7
\[ \frac{\sin \varepsilon}{\cos x \cdot \cos \left(x + \varepsilon\right)} \]

Derivation

  1. Split input into 2 regimes.
  2. if eps < -2.1454937753948827e-23 or 6.683176783612011e-65 < eps

    1. Initial program 30.6

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

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

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

      \[\leadsto \frac{\tan x + \tan \varepsilon}{1 - \color{blue}{\sqrt[3]{\left(\tan x \cdot \tan x\right) \cdot \tan x}} \cdot \sqrt[3]{\left(\tan \varepsilon \cdot \tan \varepsilon\right) \cdot \tan \varepsilon}} - \tan x\]
    7. Applied cbrt-unprod 3.8

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

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

    if -2.1454937753948827e-23 < eps < 6.683176783612011e-65

    1. Initial program 45.1

      \[\tan \left(x + \varepsilon\right) - \tan x\]
    2. Applied taylor 15.3

      \[\leadsto \varepsilon + \left({\varepsilon}^{3} \cdot {x}^{2} + {\varepsilon}^{2} \cdot x\right)\]
    3. Taylor expanded around 0 15.3

      \[\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: 50.0s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1068028399 4028058041 2917032441 2563479541 765645300 1132738916)'
(FPCore (x eps)
  :name "2tan (problem 3.3.2)"
  :herbie-expected 28

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

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