Average Error: 15.6 → 0.0
Time: 5.1s
Precision: 64
Internal precision: 384
\[\frac{x}{{x}^2 + 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -4.248855072932943 \cdot 10^{+22}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^3}\\
\mathbf{if}\;x \le 95035.66200477978:\\
\;\;\;\;\frac{x}{{x}^2 + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^3}\\
\end{array}\]
Target
| Original | 15.6 |
| Comparison | 0.1 |
| Herbie | 0.0 |
\[ \frac{1}{x + \frac{1}{x}} \]
Derivation
- Split input into 2 regimes.
-
if x < -4.248855072932943e+22 or 95035.66200477978 < x
Initial program 32.5
\[\frac{x}{{x}^2 + 1}\]
Applied taylor 0.0
\[\leadsto \left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}\]
Taylor expanded around inf 0.0
\[\leadsto \color{blue}{\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^{3}}}\]
Applied simplify 0.0
\[\leadsto \color{blue}{\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{{x}^3}}\]
if -4.248855072932943e+22 < x < 95035.66200477978
Initial program 0.0
\[\frac{x}{{x}^2 + 1}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(1064524629 4159152179 2999149171 575749698 4006532819 692958815)'
(FPCore (x)
:name "x / (x^2 + 1)"
:target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (sqr x) 1)))