\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}2 \cdot \frac{\frac{1}{x}}{-1 + x \cdot x}double f(double x) {
double r10913014 = 1.0;
double r10913015 = x;
double r10913016 = r10913015 + r10913014;
double r10913017 = r10913014 / r10913016;
double r10913018 = 2.0;
double r10913019 = r10913018 / r10913015;
double r10913020 = r10913017 - r10913019;
double r10913021 = r10913015 - r10913014;
double r10913022 = r10913014 / r10913021;
double r10913023 = r10913020 + r10913022;
return r10913023;
}
double f(double x) {
double r10913024 = 2.0;
double r10913025 = 1.0;
double r10913026 = x;
double r10913027 = r10913025 / r10913026;
double r10913028 = -1.0;
double r10913029 = r10913026 * r10913026;
double r10913030 = r10913028 + r10913029;
double r10913031 = r10913027 / r10913030;
double r10913032 = r10913024 * r10913031;
return r10913032;
}




Bits error versus x
Results
| Original | 10.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.0
rmApplied frac-sub26.3
Applied frac-add25.8
Taylor expanded around 0 0.3
rmApplied add-sqr-sqrt1.0
Applied associate-/l*0.8
rmApplied div-inv0.8
Applied *-un-lft-identity0.8
Applied sqrt-prod0.8
Applied times-frac1.0
Simplified0.8
Simplified0.1
Final simplification0.1
herbie shell --seed 2019119
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))