\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 r3385948 = x;
double r3385949 = y;
double r3385950 = r3385948 - r3385949;
double r3385951 = r3385948 + r3385949;
double r3385952 = r3385950 * r3385951;
double r3385953 = r3385948 * r3385948;
double r3385954 = r3385949 * r3385949;
double r3385955 = r3385953 + r3385954;
double r3385956 = r3385952 / r3385955;
return r3385956;
}
double f(double x, double y) {
double r3385957 = x;
double r3385958 = y;
double r3385959 = r3385957 - r3385958;
double r3385960 = hypot(r3385957, r3385958);
double r3385961 = r3385959 / r3385960;
double r3385962 = r3385957 + r3385958;
double r3385963 = r3385962 / r3385960;
double r3385964 = r3385961 * r3385963;
double r3385965 = exp(r3385964);
double r3385966 = log(r3385965);
return r3385966;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.8 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 19.8
Simplified19.8
rmApplied add-sqr-sqrt19.8
Applied times-frac19.9
rmApplied add-log-exp19.9
Simplified0.0
Final simplification0.0
herbie shell --seed 2019162 +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))))