Average Error: 15.0 → 0.0
Time: 25.9s
Precision: 64
Internal Precision: 320
\[\frac{x}{x \cdot x + 1}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -1.6203597321508256 \cdot 10^{+36}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\mathbf{if}\;x \le 489.67911998463813:\\
\;\;\;\;\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 | 15.0 |
|---|
| Target | 0.1 |
|---|
| Herbie | 0.0 |
|---|
\[\frac{1}{x + \frac{1}{x}}\]
Derivation
- Split input into 2 regimes
if x < -1.6203597321508256e+36 or 489.67911998463813 < x
Initial program 32.3
\[\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.6203597321508256e+36 < x < 489.67911998463813
Initial program 0.0
\[\frac{x}{x \cdot x + 1}\]
- Recombined 2 regimes into one program.
Runtime
herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)' +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))