\frac{x}{x \cdot x + 1}\frac{1}{x + \frac{1}{x}}double f(double x) {
double r1525318 = x;
double r1525319 = r1525318 * r1525318;
double r1525320 = 1.0;
double r1525321 = r1525319 + r1525320;
double r1525322 = r1525318 / r1525321;
return r1525322;
}
double f(double x) {
double r1525323 = 1.0;
double r1525324 = x;
double r1525325 = r1525323 / r1525324;
double r1525326 = r1525324 + r1525325;
double r1525327 = r1525323 / r1525326;
return r1525327;
}




Bits error versus x
Results
| Original | 15.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
Initial program 15.0
Simplified15.0
rmApplied add-sqr-sqrt15.0
Applied associate-/r*14.9
rmApplied *-un-lft-identity14.9
Applied associate-/l*15.0
Simplified0.1
Taylor expanded around inf 0.1
Final simplification0.1
herbie shell --seed 2019130 +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))