\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\frac{y + x}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{1}{\frac{\mathsf{hypot}\left(y, x\right)}{x - y}}double f(double x, double y) {
double r3426289 = x;
double r3426290 = y;
double r3426291 = r3426289 - r3426290;
double r3426292 = r3426289 + r3426290;
double r3426293 = r3426291 * r3426292;
double r3426294 = r3426289 * r3426289;
double r3426295 = r3426290 * r3426290;
double r3426296 = r3426294 + r3426295;
double r3426297 = r3426293 / r3426296;
return r3426297;
}
double f(double x, double y) {
double r3426298 = y;
double r3426299 = x;
double r3426300 = r3426298 + r3426299;
double r3426301 = hypot(r3426299, r3426298);
double r3426302 = r3426300 / r3426301;
double r3426303 = 1.0;
double r3426304 = hypot(r3426298, r3426299);
double r3426305 = r3426299 - r3426298;
double r3426306 = r3426304 / r3426305;
double r3426307 = r3426303 / r3426306;
double r3426308 = r3426302 * r3426307;
return r3426308;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.8 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 19.8
Simplified19.8
rmApplied add-log-exp19.8
rmApplied add-sqr-sqrt19.8
Applied times-frac19.8
Applied exp-prod19.8
Applied log-pow19.8
Simplified19.8
rmApplied *-un-lft-identity19.8
Applied associate-/l*19.8
Simplified0.0
Final simplification0.0
herbie shell --seed 2019144 +o rules:numerics
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 0 x 1) (< y 1))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1 (/ 2 (+ 1 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))