Average Error: 37.0 → 14.9
Time: 26.5s
Precision: 64
Internal Precision: 2368
$\tan \left(x + \varepsilon\right) - \tan x$
$\begin{array}{l} \mathbf{if}\;\varepsilon \le -2.776049408734746 \cdot 10^{-36} \lor \neg \left(\varepsilon \le 1.3907566449767032 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{1}{1 - \tan x \cdot \tan \varepsilon} \cdot \left(\tan \varepsilon + \tan x\right) - \tan x\\ \mathbf{else}:\\ \;\;\;\;\left({x}^{2} \cdot {\varepsilon}^{3} + {\varepsilon}^{2} \cdot x\right) + \varepsilon\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if eps < -2.776049408734746e-36 or 1.3907566449767032e-17 < eps

1. Initial program 29.6

$\tan \left(x + \varepsilon\right) - \tan x$
2. Using strategy rm
3. Applied tan-sum1.9

$\leadsto \color{blue}{\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon}} - \tan x$
4. Using strategy rm
5. Applied div-inv1.9

$\leadsto \color{blue}{\left(\tan x + \tan \varepsilon\right) \cdot \frac{1}{1 - \tan x \cdot \tan \varepsilon}} - \tan x$

## if -2.776049408734746e-36 < eps < 1.3907566449767032e-17

1. Initial program 45.6

$\tan \left(x + \varepsilon\right) - \tan x$
2. Using strategy rm
3. Applied tan-sum45.6

$\leadsto \color{blue}{\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon}} - \tan x$
4. Taylor expanded around 0 30.0

$\leadsto \color{blue}{\varepsilon + \left({\varepsilon}^{2} \cdot x + {\varepsilon}^{3} \cdot {x}^{2}\right)}$
3. Recombined 2 regimes into one program.
4. Final simplification14.9

$\leadsto \begin{array}{l} \mathbf{if}\;\varepsilon \le -2.776049408734746 \cdot 10^{-36} \lor \neg \left(\varepsilon \le 1.3907566449767032 \cdot 10^{-17}\right):\\ \;\;\;\;\frac{1}{1 - \tan x \cdot \tan \varepsilon} \cdot \left(\tan \varepsilon + \tan x\right) - \tan x\\ \mathbf{else}:\\ \;\;\;\;\left({x}^{2} \cdot {\varepsilon}^{3} + {\varepsilon}^{2} \cdot x\right) + \varepsilon\\ \end{array}$

# Runtime

Time bar (total: 26.5s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x eps)
:name "tan(x+eps)-tan(x)"
(- (tan (+ x eps)) (tan x)))