\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(x, y\right)}double f(double x, double y) {
double r92943 = x;
double r92944 = y;
double r92945 = r92943 - r92944;
double r92946 = r92943 + r92944;
double r92947 = r92945 * r92946;
double r92948 = r92943 * r92943;
double r92949 = r92944 * r92944;
double r92950 = r92948 + r92949;
double r92951 = r92947 / r92950;
return r92951;
}
double f(double x, double y) {
double r92952 = x;
double r92953 = y;
double r92954 = r92952 - r92953;
double r92955 = hypot(r92952, r92953);
double r92956 = r92954 / r92955;
double r92957 = r92952 + r92953;
double r92958 = r92957 / r92955;
double r92959 = r92956 * r92958;
return r92959;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.7 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 20.7
rmApplied add-sqr-sqrt20.7
Applied times-frac20.7
Simplified20.7
Simplified0.0
Final simplification0.0
herbie shell --seed 2020043 +o rules:numerics
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (< 0.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))))