Average Error: 15.4 → 0.0
Time: 25.4s
Precision: 64
Internal Precision: 384
\[\frac{x}{x \cdot x + 1}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -4.070794446084981 \cdot 10^{+28}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\mathbf{if}\;x \le 62622814.15891972:\\
\;\;\;\;x \cdot \frac{1}{(x \cdot x + 1)_*}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\\
\end{array}\]
Target
| Original | 15.4 |
|---|
| Target | 0.1 |
|---|
| Herbie | 0.0 |
|---|
\[\frac{1}{x + \frac{1}{x}}\]
Derivation
- Split input into 2 regimes
if x < -4.070794446084981e+28 or 62622814.15891972 < x
Initial program 32.4
\[\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 -4.070794446084981e+28 < x < 62622814.15891972
Initial program 0.0
\[\frac{x}{x \cdot x + 1}\]
- Using strategy
rm Applied div-inv0.0
\[\leadsto \color{blue}{x \cdot \frac{1}{x \cdot x + 1}}\]
Applied simplify0.0
\[\leadsto x \cdot \color{blue}{\frac{1}{(x \cdot x + 1)_*}}\]
- Recombined 2 regimes into one program.
Runtime
herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))