Average Error: 15.2 → 0.0
Time: 30.6s
Precision: 64
Internal Precision: 576
\[\frac{x}{x \cdot x + 1}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -3.389751380187937 \cdot 10^{+19}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\mathbf{if}\;x \le 11565126.45514931:\\
\;\;\;\;\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 | 15.2 |
|---|
| Target | 0.1 |
|---|
| Herbie | 0.0 |
|---|
\[\frac{1}{x + \frac{1}{x}}\]
Derivation
- Split input into 2 regimes
if x < -3.389751380187937e+19 or 11565126.45514931 < x
Initial program 31.6
\[\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 -3.389751380187937e+19 < x < 11565126.45514931
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 '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))