\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 r84651 = x;
double r84652 = y;
double r84653 = r84651 - r84652;
double r84654 = r84651 + r84652;
double r84655 = r84653 * r84654;
double r84656 = r84651 * r84651;
double r84657 = r84652 * r84652;
double r84658 = r84656 + r84657;
double r84659 = r84655 / r84658;
return r84659;
}
double f(double x, double y) {
double r84660 = x;
double r84661 = y;
double r84662 = r84660 - r84661;
double r84663 = hypot(r84660, r84661);
double r84664 = r84662 / r84663;
double r84665 = r84660 + r84661;
double r84666 = r84665 / r84663;
double r84667 = r84664 * r84666;
return r84667;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.1 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
Initial program 20.1
rmApplied add-sqr-sqrt20.1
Applied times-frac20.2
Simplified20.2
Simplified0.0
Final simplification0.0
herbie shell --seed 2019326 +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))))