Average Error: 31.6 → 0.0
Time: 2.3m
Precision: 64
Ground Truth: 128
\[\frac{x - \sin x}{x - \tan x}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -0.0006447367512968273:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\
\mathbf{if}\;x \le 63.10180000091707:\\
\;\;\;\;\frac{{\left(\frac{9}{40} \cdot {x}^2\right)}^3 - {\left({x}^{4} \cdot \frac{27}{2800} + \frac{1}{2}\right)}^3}{{\left(\frac{9}{40} \cdot {x}^2\right)}^2 + \left({\left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}^2 + \left(\frac{9}{40} \cdot {x}^2\right) \cdot \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if x < -0.0006447367512968273 or 63.10180000091707 < x
Initial program 0.1
\[\frac{x - \sin x}{x - \tan x}\]
- Using strategy
rm
Applied add-log-exp 0.1
\[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]
if -0.0006447367512968273 < x < 63.10180000091707
Initial program 62.8
\[\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)}\]
- Using strategy
rm
Applied flip3-- 0.0
\[\leadsto \color{blue}{\frac{{\left(\frac{9}{40} \cdot {x}^2\right)}^{3} - {\left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}^{3}}{{\left(\frac{9}{40} \cdot {x}^2\right)}^2 + \left({\left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}^2 + \left(\frac{9}{40} \cdot {x}^2\right) \cdot \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\right)}}\]
Applied simplify 0.0
\[\leadsto \frac{\color{blue}{{\left(\frac{9}{40} \cdot {x}^2\right)}^3 - {\left({x}^{4} \cdot \frac{27}{2800} + \frac{1}{2}\right)}^3}}{{\left(\frac{9}{40} \cdot {x}^2\right)}^2 + \left({\left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}^2 + \left(\frac{9}{40} \cdot {x}^2\right) \cdot \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\right)}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1678779530 1558603309 2181871656 3813673467 3845458450 1505327104)'
(FPCore (x)
:name "NMSE problem 3.4.5"
(/ (- x (sin x)) (- x (tan x))))