\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -8.334937415174087689151411360396824572633 \cdot 10^{151}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.980279493290019398980720829046319269044 \cdot 10^{-182}:\\
\;\;\;\;\frac{-1}{\frac{x \cdot x + y \cdot y}{y \cdot y - x \cdot x}}\\
\mathbf{elif}\;y \le -8.125759275196954844976374495366451720031 \cdot 10^{-201}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 2.44765369794749908002547762808273602123 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{x \cdot x + y \cdot y}{y \cdot y - x \cdot x}}\\
\end{array}double f(double x, double y) {
double r5822676 = x;
double r5822677 = y;
double r5822678 = r5822676 - r5822677;
double r5822679 = r5822676 + r5822677;
double r5822680 = r5822678 * r5822679;
double r5822681 = r5822676 * r5822676;
double r5822682 = r5822677 * r5822677;
double r5822683 = r5822681 + r5822682;
double r5822684 = r5822680 / r5822683;
return r5822684;
}
double f(double x, double y) {
double r5822685 = y;
double r5822686 = -8.334937415174088e+151;
bool r5822687 = r5822685 <= r5822686;
double r5822688 = -1.0;
double r5822689 = -1.9802794932900194e-182;
bool r5822690 = r5822685 <= r5822689;
double r5822691 = x;
double r5822692 = r5822691 * r5822691;
double r5822693 = r5822685 * r5822685;
double r5822694 = r5822692 + r5822693;
double r5822695 = r5822693 - r5822692;
double r5822696 = r5822694 / r5822695;
double r5822697 = r5822688 / r5822696;
double r5822698 = -8.125759275196955e-201;
bool r5822699 = r5822685 <= r5822698;
double r5822700 = 2.447653697947499e-162;
bool r5822701 = r5822685 <= r5822700;
double r5822702 = 1.0;
double r5822703 = r5822701 ? r5822702 : r5822697;
double r5822704 = r5822699 ? r5822688 : r5822703;
double r5822705 = r5822690 ? r5822697 : r5822704;
double r5822706 = r5822687 ? r5822688 : r5822705;
return r5822706;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.5 |
|---|---|
| Target | 0.0 |
| Herbie | 5.2 |
if y < -8.334937415174088e+151 or -1.9802794932900194e-182 < y < -8.125759275196955e-201Initial program 59.8
Simplified59.8
Taylor expanded around inf 3.8
if -8.334937415174088e+151 < y < -1.9802794932900194e-182 or 2.447653697947499e-162 < y Initial program 1.1
Simplified1.2
rmApplied clear-num1.2
if -8.125759275196955e-201 < y < 2.447653697947499e-162Initial program 30.2
Simplified30.2
Taylor expanded around 0 13.8
Final simplification5.2
herbie shell --seed 2019168
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 0.0 x 1.0) (< y 1.0))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2.0) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))