\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -2.35356263340194646 \cdot 10^{-113}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 7.03047708396554176 \cdot 10^{-131}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r116448 = x;
double r116449 = y;
double r116450 = r116448 - r116449;
double r116451 = r116448 + r116449;
double r116452 = r116450 * r116451;
double r116453 = r116448 * r116448;
double r116454 = r116449 * r116449;
double r116455 = r116453 + r116454;
double r116456 = r116452 / r116455;
return r116456;
}
double f(double __attribute__((unused)) x, double y) {
double r116457 = y;
double r116458 = -2.3535626334019465e-113;
bool r116459 = r116457 <= r116458;
double r116460 = -1.0;
double r116461 = 7.030477083965542e-131;
bool r116462 = r116457 <= r116461;
double r116463 = 1.0;
double r116464 = r116462 ? r116463 : r116460;
double r116465 = r116459 ? r116460 : r116464;
return r116465;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.6 |
|---|---|
| Target | 0.0 |
| Herbie | 11.0 |
if y < -2.3535626334019465e-113 or 7.030477083965542e-131 < y Initial program 18.5
Taylor expanded around 0 5.7
if -2.3535626334019465e-113 < y < 7.030477083965542e-131Initial program 23.6
Taylor expanded around inf 18.8
Final simplification11.0
herbie shell --seed 2020046
(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))))