\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3363011022663002 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -4.452451271730543 \cdot 10^{-154}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(y + x\right)}}\\
\mathbf{elif}\;y \le 2.6338497742796816 \cdot 10^{-188}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{\sqrt{x \cdot x + y \cdot y}} \cdot \frac{1}{\frac{\sqrt{x \cdot x + y \cdot y}}{x - y}}\\
\end{array}double f(double x, double y) {
double r14610732 = x;
double r14610733 = y;
double r14610734 = r14610732 - r14610733;
double r14610735 = r14610732 + r14610733;
double r14610736 = r14610734 * r14610735;
double r14610737 = r14610732 * r14610732;
double r14610738 = r14610733 * r14610733;
double r14610739 = r14610737 + r14610738;
double r14610740 = r14610736 / r14610739;
return r14610740;
}
double f(double x, double y) {
double r14610741 = y;
double r14610742 = -1.3363011022663002e+154;
bool r14610743 = r14610741 <= r14610742;
double r14610744 = -1.0;
double r14610745 = -4.452451271730543e-154;
bool r14610746 = r14610741 <= r14610745;
double r14610747 = 1.0;
double r14610748 = x;
double r14610749 = r14610748 * r14610748;
double r14610750 = r14610741 * r14610741;
double r14610751 = r14610749 + r14610750;
double r14610752 = r14610748 - r14610741;
double r14610753 = r14610741 + r14610748;
double r14610754 = r14610752 * r14610753;
double r14610755 = r14610751 / r14610754;
double r14610756 = r14610747 / r14610755;
double r14610757 = 2.6338497742796816e-188;
bool r14610758 = r14610741 <= r14610757;
double r14610759 = sqrt(r14610751);
double r14610760 = r14610753 / r14610759;
double r14610761 = r14610759 / r14610752;
double r14610762 = r14610747 / r14610761;
double r14610763 = r14610760 * r14610762;
double r14610764 = r14610758 ? r14610747 : r14610763;
double r14610765 = r14610746 ? r14610756 : r14610764;
double r14610766 = r14610743 ? r14610744 : r14610765;
return r14610766;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.5 |
|---|---|
| Target | 0.1 |
| Herbie | 5.5 |
if y < -1.3363011022663002e+154Initial program 63.6
Taylor expanded around 0 0
if -1.3363011022663002e+154 < y < -4.452451271730543e-154Initial program 0.0
rmApplied clear-num0.0
if -4.452451271730543e-154 < y < 2.6338497742796816e-188Initial program 29.1
Taylor expanded around -inf 15.2
if 2.6338497742796816e-188 < y Initial program 4.5
rmApplied clear-num4.5
rmApplied add-sqr-sqrt4.5
Applied times-frac4.9
Applied add-cube-cbrt4.9
Applied times-frac4.9
Simplified4.9
Final simplification5.5
herbie shell --seed 2019121
(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))))