\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{\mathsf{hypot}\left(x, y\right)}{x + y}}}\right)double f(double x, double y) {
double r91931 = x;
double r91932 = y;
double r91933 = r91931 - r91932;
double r91934 = r91931 + r91932;
double r91935 = r91933 * r91934;
double r91936 = r91931 * r91931;
double r91937 = r91932 * r91932;
double r91938 = r91936 + r91937;
double r91939 = r91935 / r91938;
return r91939;
}
double f(double x, double y) {
double r91940 = x;
double r91941 = y;
double r91942 = r91940 - r91941;
double r91943 = hypot(r91940, r91941);
double r91944 = r91940 + r91941;
double r91945 = r91943 / r91944;
double r91946 = r91943 * r91945;
double r91947 = r91942 / r91946;
double r91948 = exp(r91947);
double r91949 = log(r91948);
return r91949;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.3 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 20.3
Simplified20.4
rmApplied *-un-lft-identity20.4
Applied add-sqr-sqrt20.4
Applied times-frac20.3
Simplified20.3
Simplified0.0
rmApplied add-log-exp0.0
Final simplification0.0
herbie shell --seed 2020001 +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))))