Average Error: 15.0 → 0.0
Time: 18.9s
Precision: 64
Internal precision: 128
\[\frac{x}{{x}^2 + 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -162969717.01587787:\\
\;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\
\mathbf{if}\;x \le 38849.916482614:\\
\;\;\;\;\frac{x}{{\left({x}^2\right)}^2 - {1}^2} \cdot \left({x}^2 - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\\
\end{array}\]
Target
| Original | 15.0 |
| Comparison | 0.1 |
| Herbie | 0.0 |
\[ \frac{1}{x + \frac{1}{x}} \]
Derivation
- Split input into 2 regimes.
-
if x < -162969717.01587787 or 38849.916482614 < x
Initial program 30.5
\[\frac{x}{{x}^2 + 1}\]
Applied taylor 0.0
\[\leadsto \left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}\]
Taylor expanded around inf 0.0
\[\leadsto \color{blue}{\left(\frac{1}{x} + \frac{1}{{x}^{5}}\right) - \frac{1}{{x}^{3}}}\]
if -162969717.01587787 < x < 38849.916482614
Initial program 0.0
\[\frac{x}{{x}^2 + 1}\]
- Using strategy
rm
Applied flip-+ 0.0
\[\leadsto \frac{x}{\color{blue}{\frac{{\left({x}^2\right)}^2 - {1}^2}{{x}^2 - 1}}}\]
Applied associate-/r/ 0.0
\[\leadsto \color{blue}{\frac{x}{{\left({x}^2\right)}^2 - {1}^2} \cdot \left({x}^2 - 1\right)}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1395211471 3142137489 386578953 58333272 1700701722 3453428969)'
(FPCore (x)
:name "x / (x^2 + 1)"
:target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (sqr x) 1)))