\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\log \left(e^{\frac{\frac{x - y}{\mathsf{hypot}\left(x, y\right)}}{\frac{\mathsf{hypot}\left(x, y\right)}{x + y}}}\right)double f(double x, double y) {
double r104425 = x;
double r104426 = y;
double r104427 = r104425 - r104426;
double r104428 = r104425 + r104426;
double r104429 = r104427 * r104428;
double r104430 = r104425 * r104425;
double r104431 = r104426 * r104426;
double r104432 = r104430 + r104431;
double r104433 = r104429 / r104432;
return r104433;
}
double f(double x, double y) {
double r104434 = x;
double r104435 = y;
double r104436 = r104434 - r104435;
double r104437 = hypot(r104434, r104435);
double r104438 = r104436 / r104437;
double r104439 = r104434 + r104435;
double r104440 = r104437 / r104439;
double r104441 = r104438 / r104440;
double r104442 = exp(r104441);
double r104443 = log(r104442);
return r104443;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.4 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 20.4
rmApplied add-sqr-sqrt20.4
Applied associate-/r*20.4
Simplified20.5
rmApplied associate-/r/20.5
Applied associate-/l*20.5
Simplified0.0
rmApplied add-log-exp0.0
Final simplification0.0
herbie shell --seed 2020049 +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))))