\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(x, y\right)}\right)\right)double f(double x, double y) {
double r1979914 = x;
double r1979915 = y;
double r1979916 = r1979914 - r1979915;
double r1979917 = r1979914 + r1979915;
double r1979918 = r1979916 * r1979917;
double r1979919 = r1979914 * r1979914;
double r1979920 = r1979915 * r1979915;
double r1979921 = r1979919 + r1979920;
double r1979922 = r1979918 / r1979921;
return r1979922;
}
double f(double x, double y) {
double r1979923 = x;
double r1979924 = y;
double r1979925 = r1979923 - r1979924;
double r1979926 = hypot(r1979923, r1979924);
double r1979927 = r1979925 / r1979926;
double r1979928 = r1979923 + r1979924;
double r1979929 = r1979928 / r1979926;
double r1979930 = r1979927 * r1979929;
double r1979931 = log1p(r1979930);
double r1979932 = expm1(r1979931);
return r1979932;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.4 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 20.4
rmApplied clear-num20.4
Simplified20.4
rmApplied difference-of-squares20.4
Applied add-sqr-sqrt20.4
Applied times-frac20.4
Applied add-cube-cbrt20.4
Applied times-frac20.4
Simplified20.4
Simplified0.0
rmApplied expm1-log1p-u0.0
Final simplification0.0
herbie shell --seed 2019138 +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))))