\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.364714454837564 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -3.2241936526231514 \cdot 10^{-170}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + y \cdot y} - \log \left(e^{\frac{1}{\frac{x \cdot x + y \cdot y}{y \cdot y}}}\right)\\
\mathbf{elif}\;y \le -1.0663270652980943 \cdot 10^{-198}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 6.518473908454177 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + y \cdot y} - \log \left(e^{\frac{1}{\frac{x \cdot x + y \cdot y}{y \cdot y}}}\right)\\
\end{array}double f(double x, double y) {
double r3058123 = x;
double r3058124 = y;
double r3058125 = r3058123 - r3058124;
double r3058126 = r3058123 + r3058124;
double r3058127 = r3058125 * r3058126;
double r3058128 = r3058123 * r3058123;
double r3058129 = r3058124 * r3058124;
double r3058130 = r3058128 + r3058129;
double r3058131 = r3058127 / r3058130;
return r3058131;
}
double f(double x, double y) {
double r3058132 = y;
double r3058133 = -1.364714454837564e+154;
bool r3058134 = r3058132 <= r3058133;
double r3058135 = -1.0;
double r3058136 = -3.2241936526231514e-170;
bool r3058137 = r3058132 <= r3058136;
double r3058138 = x;
double r3058139 = r3058138 * r3058138;
double r3058140 = r3058132 * r3058132;
double r3058141 = r3058139 + r3058140;
double r3058142 = r3058139 / r3058141;
double r3058143 = 1.0;
double r3058144 = r3058141 / r3058140;
double r3058145 = r3058143 / r3058144;
double r3058146 = exp(r3058145);
double r3058147 = log(r3058146);
double r3058148 = r3058142 - r3058147;
double r3058149 = -1.0663270652980943e-198;
bool r3058150 = r3058132 <= r3058149;
double r3058151 = 6.518473908454177e-162;
bool r3058152 = r3058132 <= r3058151;
double r3058153 = r3058152 ? r3058143 : r3058148;
double r3058154 = r3058150 ? r3058135 : r3058153;
double r3058155 = r3058137 ? r3058148 : r3058154;
double r3058156 = r3058134 ? r3058135 : r3058155;
return r3058156;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.6 |
|---|---|
| Target | 0.1 |
| Herbie | 5.3 |
if y < -1.364714454837564e+154 or -3.2241936526231514e-170 < y < -1.0663270652980943e-198Initial program 58.3
Simplified58.3
rmApplied add-log-exp58.3
Taylor expanded around 0 6.2
if -1.364714454837564e+154 < y < -3.2241936526231514e-170 or 6.518473908454177e-162 < y Initial program 0.4
Simplified0.4
rmApplied add-log-exp0.4
rmApplied clear-num0.4
if -1.0663270652980943e-198 < y < 6.518473908454177e-162Initial program 28.6
Simplified28.6
Taylor expanded around inf 13.5
Final simplification5.3
herbie shell --seed 2019134
(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))))