\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le -111.668557999259363 \lor \neg \left(x \le 124.371664628461232\right):\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{2}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1 - 2 \cdot \left(x + 1\right)}{x \cdot 1 + x \cdot x} + \frac{1}{x - 1}\\
\end{array}double code(double x) {
return ((double) (((double) ((1.0 / ((double) (x + 1.0))) - (2.0 / x))) + (1.0 / ((double) (x - 1.0)))));
}
double code(double x) {
double VAR;
if (((x <= -111.66855799925936) || !(x <= 124.37166462846123))) {
VAR = ((double) ((2.0 / ((double) pow(x, 7.0))) + ((double) ((2.0 / ((double) pow(x, 5.0))) + (2.0 / ((double) pow(x, 3.0)))))));
} else {
VAR = ((double) ((((double) (((double) (x * 1.0)) - ((double) (2.0 * ((double) (x + 1.0)))))) / ((double) (((double) (x * 1.0)) + ((double) (x * x))))) + (1.0 / ((double) (x - 1.0)))));
}
return VAR;
}




Bits error versus x
Results
| Original | 9.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if x < -111.668557999259363 or 124.371664628461232 < x Initial program 19.5
Taylor expanded around inf 0.6
Simplified0.6
if -111.668557999259363 < x < 124.371664628461232Initial program 0.0
rmApplied frac-sub0.0
Simplified0.0
Simplified0.0
rmApplied distribute-lft-in0.1
Simplified0.1
Final simplification0.3
herbie shell --seed 2020182
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2.0 (* x (- (* x x) 1.0)))
(+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))