Average Error: 14.2 → 0.0
Time: 50.4s
Precision: 64
Internal Precision: 384
\[\frac{x}{x \cdot x + 1}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -1.4883537736955925 \cdot 10^{+27}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\mathbf{if}\;x \le 2859.9798077968026:\\
\;\;\;\;\frac{x}{x \cdot x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\end{array}\]
Target
| Original | 14.2 |
|---|
| Target | 0.1 |
|---|
| Herbie | 0.0 |
|---|
\[\frac{1}{x + \frac{1}{x}}\]
Derivation
- Split input into 2 regimes
if x < -1.4883537736955925e+27 or 2859.9798077968026 < x
Initial program 30.5
\[\frac{x}{x \cdot x + 1}\]
Taylor expanded around inf 0.0
\[\leadsto \color{blue}{\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}}\]
if -1.4883537736955925e+27 < x < 2859.9798077968026
Initial program 0.0
\[\frac{x}{x \cdot x + 1}\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1063027428 1192549564 1443466578 604016274 3637110559 1698629644)'
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))