\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{1}{\frac{\mathsf{hypot}\left(x, y\right)}{y + x}}double f(double x, double y) {
double r3414485 = x;
double r3414486 = y;
double r3414487 = r3414485 - r3414486;
double r3414488 = r3414485 + r3414486;
double r3414489 = r3414487 * r3414488;
double r3414490 = r3414485 * r3414485;
double r3414491 = r3414486 * r3414486;
double r3414492 = r3414490 + r3414491;
double r3414493 = r3414489 / r3414492;
return r3414493;
}
double f(double x, double y) {
double r3414494 = x;
double r3414495 = y;
double r3414496 = r3414494 - r3414495;
double r3414497 = hypot(r3414494, r3414495);
double r3414498 = r3414496 / r3414497;
double r3414499 = 1.0;
double r3414500 = r3414495 + r3414494;
double r3414501 = r3414497 / r3414500;
double r3414502 = r3414499 / r3414501;
double r3414503 = r3414498 * r3414502;
return r3414503;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
Initial program 19.5
Simplified19.5
rmApplied clear-num19.5
rmApplied add-sqr-sqrt19.5
Applied times-frac19.5
Applied add-cube-cbrt19.5
Applied times-frac19.5
Simplified19.5
Simplified0.0
rmApplied clear-num0.0
Final simplification0.0
herbie shell --seed 2019158 +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))))