\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -3.847434879443193393633321330852372755378 \cdot 10^{151}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.694063246808970668811003130641552295003 \cdot 10^{-162}:\\
\;\;\;\;\log \left(e^{\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}}\right)\\
\mathbf{elif}\;y \le 6.451959238219760281097758056287369172736 \cdot 10^{-208}:\\
\;\;\;\;\log \left(e^{1}\right)\\
\mathbf{elif}\;y \le 1.336866892806927934140174920733392856435 \cdot 10^{-166}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}}\right)\\
\end{array}double f(double x, double y) {
double r113916 = x;
double r113917 = y;
double r113918 = r113916 - r113917;
double r113919 = r113916 + r113917;
double r113920 = r113918 * r113919;
double r113921 = r113916 * r113916;
double r113922 = r113917 * r113917;
double r113923 = r113921 + r113922;
double r113924 = r113920 / r113923;
return r113924;
}
double f(double x, double y) {
double r113925 = y;
double r113926 = -3.8474348794431934e+151;
bool r113927 = r113925 <= r113926;
double r113928 = -1.0;
double r113929 = -1.6940632468089707e-162;
bool r113930 = r113925 <= r113929;
double r113931 = x;
double r113932 = r113931 - r113925;
double r113933 = r113931 + r113925;
double r113934 = r113932 * r113933;
double r113935 = r113931 * r113931;
double r113936 = r113925 * r113925;
double r113937 = r113935 + r113936;
double r113938 = r113934 / r113937;
double r113939 = exp(r113938);
double r113940 = log(r113939);
double r113941 = 6.45195923821976e-208;
bool r113942 = r113925 <= r113941;
double r113943 = 1.0;
double r113944 = exp(r113943);
double r113945 = log(r113944);
double r113946 = 1.336866892806928e-166;
bool r113947 = r113925 <= r113946;
double r113948 = r113947 ? r113928 : r113940;
double r113949 = r113942 ? r113945 : r113948;
double r113950 = r113930 ? r113940 : r113949;
double r113951 = r113927 ? r113928 : r113950;
return r113951;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.6 |
|---|---|
| Target | 0.0 |
| Herbie | 5.5 |
if y < -3.8474348794431934e+151 or 6.45195923821976e-208 < y < 1.336866892806928e-166Initial program 55.7
Taylor expanded around 0 8.5
if -3.8474348794431934e+151 < y < -1.6940632468089707e-162 or 1.336866892806928e-166 < y Initial program 0.3
rmApplied add-log-exp0.3
if -1.6940632468089707e-162 < y < 6.45195923821976e-208Initial program 28.7
rmApplied add-log-exp28.7
Taylor expanded around inf 13.4
Final simplification5.5
herbie shell --seed 2019353
(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))))