\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{\frac{x + 1}{1} \cdot x}}{x - 1}double f(double x) {
double r225123 = 1.0;
double r225124 = x;
double r225125 = r225124 + r225123;
double r225126 = r225123 / r225125;
double r225127 = 2.0;
double r225128 = r225127 / r225124;
double r225129 = r225126 - r225128;
double r225130 = r225124 - r225123;
double r225131 = r225123 / r225130;
double r225132 = r225129 + r225131;
return r225132;
}
double f(double x) {
double r225133 = 2.0;
double r225134 = x;
double r225135 = 1.0;
double r225136 = r225134 + r225135;
double r225137 = r225136 / r225135;
double r225138 = r225137 * r225134;
double r225139 = r225133 / r225138;
double r225140 = r225134 - r225135;
double r225141 = r225139 / r225140;
return r225141;
}




Bits error versus x
Results
| Original | 9.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 9.7
rmApplied clear-num9.7
rmApplied frac-sub26.0
Applied frac-add25.5
Taylor expanded around 0 0.2
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2019356
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))