\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\log \left(e^{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(x - y\right) \cdot \frac{\frac{x + y}{\mathsf{hypot}\left(x, y\right)}}{\mathsf{hypot}\left(x, y\right)}\right)\right)}\right)double f(double x, double y) {
double r127563 = x;
double r127564 = y;
double r127565 = r127563 - r127564;
double r127566 = r127563 + r127564;
double r127567 = r127565 * r127566;
double r127568 = r127563 * r127563;
double r127569 = r127564 * r127564;
double r127570 = r127568 + r127569;
double r127571 = r127567 / r127570;
return r127571;
}
double f(double x, double y) {
double r127572 = x;
double r127573 = y;
double r127574 = r127572 - r127573;
double r127575 = r127572 + r127573;
double r127576 = hypot(r127572, r127573);
double r127577 = r127575 / r127576;
double r127578 = r127577 / r127576;
double r127579 = r127574 * r127578;
double r127580 = expm1(r127579);
double r127581 = log1p(r127580);
double r127582 = exp(r127581);
double r127583 = log(r127582);
return r127583;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
Initial program 20.8
rmApplied add-sqr-sqrt20.8
Applied times-frac20.8
Simplified20.8
Simplified0.0
rmApplied add-log-exp0.0
rmApplied log1p-expm1-u0.0
rmApplied div-inv0.0
Applied associate-*l*0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019347 +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))))