\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(e^{\frac{x + y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x - y}{\mathsf{hypot}\left(y, x\right)}}\right)\right)\right)double f(double x, double y) {
double r126624 = x;
double r126625 = y;
double r126626 = r126624 - r126625;
double r126627 = r126624 + r126625;
double r126628 = r126626 * r126627;
double r126629 = r126624 * r126624;
double r126630 = r126625 * r126625;
double r126631 = r126629 + r126630;
double r126632 = r126628 / r126631;
return r126632;
}
double f(double x, double y) {
double r126633 = x;
double r126634 = y;
double r126635 = r126633 + r126634;
double r126636 = hypot(r126634, r126633);
double r126637 = r126635 / r126636;
double r126638 = r126633 - r126634;
double r126639 = r126638 / r126636;
double r126640 = r126637 * r126639;
double r126641 = exp(r126640);
double r126642 = log(r126641);
double r126643 = expm1(r126642);
double r126644 = log1p(r126643);
return r126644;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.4 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 20.4
Simplified20.6
rmApplied add-sqr-sqrt20.6
Applied *-un-lft-identity20.6
Applied times-frac20.5
Simplified20.5
Simplified0.2
rmApplied log1p-expm1-u0.1
Simplified0.0
rmApplied add-log-exp0.0
Final simplification0.0
herbie shell --seed 2019208 +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))))