Average Error: 30.9 → 0.1
Time: 1.4m
Precision: 64
Ground Truth: 128
\[\frac{x - \sin x}{x - \tan x}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -7.829158115972637 \cdot 10^{-05}:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\
\mathbf{if}\;x \le 849008901.3057916:\\
\;\;\;\;\frac{-1}{2} - \left({x}^{4} \cdot \frac{27}{2800} - x \cdot \left(x \cdot \frac{9}{40}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\
\end{array}\]
Derivation
- Split input into 3 regimes.
-
if x < -7.829158115972637e-05
Initial program 0.2
\[\frac{x - \sin x}{x - \tan x}\]
if -7.829158115972637e-05 < x < 849008901.3057916
Initial program 62.9
\[\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({\left(\sqrt{\frac{-1}{2}}\right)}^2 + \frac{9}{40} \cdot {x}^2\right) - \frac{27}{2800} \cdot {x}^{4}\]
Taylor expanded around 0 63.6
\[\leadsto \color{blue}{\left({\left(\sqrt{\frac{-1}{2}}\right)}^2 + \frac{9}{40} \cdot {x}^2\right) - \frac{27}{2800} \cdot {x}^{4}}\]
Applied simplify 0.0
\[\leadsto \color{blue}{\frac{-1}{2} - \left({x}^{4} \cdot \frac{27}{2800} - x \cdot \left(x \cdot \frac{9}{40}\right)\right)}\]
if 849008901.3057916 < 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 --seed '#(4267190536 1155548794 4224813166 2347178597 3852352482 3815186076)'
(FPCore (x)
:name "NMSE problem 3.4.5"
(/ (- x (sin x)) (- x (tan x))))