Average Error: 14.4 → 0.1
Time: 20.8s
Precision: 64
Ground Truth: 128
\[\frac{1}{x + 1} - \frac{1}{x}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -1374145471961931.2:\\
\;\;\;\;\frac{1}{{x}^{3}} - \left(\frac{\frac{1}{x}}{x} + \frac{1}{{x}^{4}}\right)\\
\mathbf{if}\;x \le 15701021957088522.0:\\
\;\;\;\;\frac{x - \left(1 + x\right)}{\left(x + 1\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{x}^{3}} - \left(\frac{\frac{1}{x}}{x} + \frac{1}{{x}^{4}}\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if x < -1374145471961931.2 or 15701021957088522.0 < x
Initial program 29.1
\[\frac{1}{x + 1} - \frac{1}{x}\]
Applied taylor 0.7
\[\leadsto \frac{1}{{x}^{3}} - \left(\frac{1}{{x}^2} + \frac{1}{{x}^{4}}\right)\]
Taylor expanded around inf 0.7
\[\leadsto \color{blue}{\frac{1}{{x}^{3}} - \left(\frac{1}{{x}^2} + \frac{1}{{x}^{4}}\right)}\]
- Using strategy
rm
Applied square-mult 0.7
\[\leadsto \frac{1}{{x}^{3}} - \left(\frac{1}{\color{blue}{x \cdot x}} + \frac{1}{{x}^{4}}\right)\]
Applied associate-/r* 0.1
\[\leadsto \frac{1}{{x}^{3}} - \left(\color{blue}{\frac{\frac{1}{x}}{x}} + \frac{1}{{x}^{4}}\right)\]
if -1374145471961931.2 < x < 15701021957088522.0
Initial program 1.3
\[\frac{1}{x + 1} - \frac{1}{x}\]
- Using strategy
rm
Applied frac-sub 0.0
\[\leadsto \color{blue}{\frac{1 \cdot x - \left(x + 1\right) \cdot 1}{\left(x + 1\right) \cdot x}}\]
Applied simplify 0.0
\[\leadsto \frac{\color{blue}{x - \left(1 + x\right)}}{\left(x + 1\right) \cdot x}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(3361196376 1818039471 2480134366 3803070597 1215164070 3576802717)'
(FPCore (x)
:name "NMSE problem 3.3.1"
(- (/ 1 (+ x 1)) (/ 1 x)))