Average Error: 31.3 → 0.1
Time: 2.3m
Precision: 64
Internal precision: 2432
\[\frac{x - \sin x}{x - \tan x}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -9.950485992669078 \cdot 10^{-09}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\
\mathbf{if}\;x \le 0.16631490308113306:\\
\;\;\;\;\frac{9}{40} \cdot {x}^2 - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\
\end{array}\]
Derivation
- Split input into 3 regimes.
-
if x < -9.950485992669078e-09
Initial program 0.4
\[\frac{x - \sin x}{x - \tan x}\]
- Using strategy
rm
Applied div-sub 0.4
\[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
if -9.950485992669078e-09 < x < 0.16631490308113306
Initial program 63.2
\[\frac{x - \sin x}{x - \tan x}\]
Applied taylor 0.0
\[\leadsto \frac{9}{40} \cdot {x}^2 - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\]
Taylor expanded around 0 0.0
\[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^2 - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
if 0.16631490308113306 < x
Initial program 0.0
\[\frac{x - \sin x}{x - \tan x}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(772101555 1905824529 294602591 2478279198 2123125427 4197813737)'
(FPCore (x)
:name "sintan (problem 3.4.5)"
(/ (- x (sin x)) (- x (tan x))))