Average Error: 31.6 → 0.1
Time: 18.8s
Precision: 64
Internal precision: 2432
\[\frac{x - \sin x}{x - \tan x}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -4.010384934750878 \cdot 10^{-06}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\
\mathbf{if}\;x \le 18533.742864951855:\\
\;\;\;\;\left(\frac{9}{40} \cdot {x}^2 - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{\frac{x - \sin x}{x - \tan x}}\right)}^2\\
\end{array}\]
Derivation
- Split input into 3 regimes.
-
if x < -4.010384934750878e-06
Initial program 0.3
\[\frac{x - \sin x}{x - \tan x}\]
- Using strategy
rm
Applied div-sub 0.3
\[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
if -4.010384934750878e-06 < x < 18533.742864951855
Initial program 62.8
\[\frac{x - \sin x}{x - \tan x}\]
- Using strategy
rm
Applied add-sqr-sqrt 63.6
\[\leadsto \color{blue}{{\left(\sqrt{\frac{x - \sin x}{x - \tan x}}\right)}^2}\]
Applied taylor 63.6
\[\leadsto {\left(\sqrt{\frac{9}{40} \cdot {x}^2 - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\right)}^2\]
Taylor expanded around 0 63.6
\[\leadsto {\left(\sqrt{\color{blue}{\frac{9}{40} \cdot {x}^2 - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}}\right)}^2\]
Applied simplify 0.0
\[\leadsto \color{blue}{\left(\frac{9}{40} \cdot {x}^2 - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}}\]
if 18533.742864951855 < x
Initial program 0.0
\[\frac{x - \sin x}{x - \tan x}\]
- Using strategy
rm
Applied add-sqr-sqrt 0.0
\[\leadsto \color{blue}{{\left(\sqrt{\frac{x - \sin x}{x - \tan x}}\right)}^2}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(1066785882 2324371342 4059510649 1466361199 2701357084 1216585281)'
(FPCore (x)
:name "sintan (problem 3.4.5)"
(/ (- x (sin x)) (- x (tan x))))