\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\log \left(e^{\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(x, y\right)}}\right)double f(double x, double y) {
double r85409 = x;
double r85410 = y;
double r85411 = r85409 - r85410;
double r85412 = r85409 + r85410;
double r85413 = r85411 * r85412;
double r85414 = r85409 * r85409;
double r85415 = r85410 * r85410;
double r85416 = r85414 + r85415;
double r85417 = r85413 / r85416;
return r85417;
}
double f(double x, double y) {
double r85418 = x;
double r85419 = y;
double r85420 = r85418 - r85419;
double r85421 = hypot(r85418, r85419);
double r85422 = r85420 / r85421;
double r85423 = r85418 + r85419;
double r85424 = r85423 / r85421;
double r85425 = r85422 * r85424;
double r85426 = exp(r85425);
double r85427 = log(r85426);
return r85427;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.7 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
Initial program 20.7
rmApplied add-sqr-sqrt20.7
Simplified20.7
Simplified20.7
rmApplied times-frac0.0
rmApplied add-log-exp0.0
Final simplification0.0
herbie shell --seed 2020027 +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))))