\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le 1.2655507157052785 \cdot 10^{+49}:\\
\;\;\;\;\frac{2}{\left(x + x \cdot x\right) \cdot x - \left(x + x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{2}{x}}{x \cdot x} + \frac{2}{{x}^{5}}\right) + \frac{2}{{x}^{7}}\\
\end{array}double f(double x) {
double r8851461 = 1.0;
double r8851462 = x;
double r8851463 = r8851462 + r8851461;
double r8851464 = r8851461 / r8851463;
double r8851465 = 2.0;
double r8851466 = r8851465 / r8851462;
double r8851467 = r8851464 - r8851466;
double r8851468 = r8851462 - r8851461;
double r8851469 = r8851461 / r8851468;
double r8851470 = r8851467 + r8851469;
return r8851470;
}
double f(double x) {
double r8851471 = x;
double r8851472 = 1.2655507157052785e+49;
bool r8851473 = r8851471 <= r8851472;
double r8851474 = 2.0;
double r8851475 = r8851471 * r8851471;
double r8851476 = r8851471 + r8851475;
double r8851477 = r8851476 * r8851471;
double r8851478 = r8851477 - r8851476;
double r8851479 = r8851474 / r8851478;
double r8851480 = r8851474 / r8851471;
double r8851481 = r8851480 / r8851475;
double r8851482 = 5.0;
double r8851483 = pow(r8851471, r8851482);
double r8851484 = r8851474 / r8851483;
double r8851485 = r8851481 + r8851484;
double r8851486 = 7.0;
double r8851487 = pow(r8851471, r8851486);
double r8851488 = r8851474 / r8851487;
double r8851489 = r8851485 + r8851488;
double r8851490 = r8851473 ? r8851479 : r8851489;
return r8851490;
}




Bits error versus x
Results
| Original | 9.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
if x < 1.2655507157052785e+49Initial program 8.8
rmApplied +-commutative8.8
rmApplied sub-neg8.8
Applied associate-+r+8.8
Simplified8.8
rmApplied frac-add19.3
Applied frac-add18.5
Simplified18.5
Simplified18.5
Taylor expanded around 0 0.2
if 1.2655507157052785e+49 < x Initial program 13.7
rmApplied +-commutative13.7
rmApplied sub-neg13.7
Applied associate-+r+13.7
Simplified13.7
Taylor expanded around inf 0.7
Simplified0.1
Final simplification0.1
herbie shell --seed 2019120
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))