Average Error: 14.7 → 0.0
Time: 38.6s
Precision: 64
Internal Precision: 576
\[\frac{x}{x \cdot x + 1}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -5.981537352702529 \cdot 10^{+27}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\mathbf{if}\;x \le 383.92049550736056:\\
\;\;\;\;\log_* (1 + (e^{\frac{x}{(x \cdot x + 1)_*}} - 1)^*)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\end{array}\]
Target
| Original | 14.7 |
|---|
| Target | 0.1 |
|---|
| Herbie | 0.0 |
|---|
\[\frac{1}{x + \frac{1}{x}}\]
Derivation
- Split input into 2 regimes
if x < -5.981537352702529e+27 or 383.92049550736056 < x
Initial program 30.9
\[\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 -5.981537352702529e+27 < x < 383.92049550736056
Initial program 0.0
\[\frac{x}{x \cdot x + 1}\]
- Using strategy
rm Applied log1p-expm1-u0.0
\[\leadsto \color{blue}{\log_* (1 + (e^{\frac{x}{x \cdot x + 1}} - 1)^*)}\]
Applied simplify0.0
\[\leadsto \log_* (1 + \color{blue}{(e^{\frac{x}{(x \cdot x + 1)_*}} - 1)^*})\]
- Recombined 2 regimes into one program.
Runtime
herbie shell --seed '#(1071821486 549052472 3784827256 1559736200 3548510075 881134285)' +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))