\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -5.375278492253273374474910915175481103343 \cdot 10^{150}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le \frac{-8857542091609865}{1.013065324433836171511818326096474890384 \cdot 10^{177}}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(x + y\right)}}\\
\mathbf{elif}\;y \le \frac{544484586544869}{1.425762693006936005825366126781341039029 \cdot 10^{191}}:\\
\;\;\;\;\log \left(e^{1}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{\left(x - y\right) \cdot x + \left(x - y\right) \cdot y}{x \cdot x + y \cdot y}}\right)\\
\end{array}double f(double x, double y) {
double r74858 = x;
double r74859 = y;
double r74860 = r74858 - r74859;
double r74861 = r74858 + r74859;
double r74862 = r74860 * r74861;
double r74863 = r74858 * r74858;
double r74864 = r74859 * r74859;
double r74865 = r74863 + r74864;
double r74866 = r74862 / r74865;
return r74866;
}
double f(double x, double y) {
double r74867 = y;
double r74868 = -5.3752784922532734e+150;
bool r74869 = r74867 <= r74868;
double r74870 = -1.0;
double r74871 = -8857542091609865.0;
double r74872 = 1.0130653244338362e+177;
double r74873 = r74871 / r74872;
bool r74874 = r74867 <= r74873;
double r74875 = 1.0;
double r74876 = x;
double r74877 = r74876 * r74876;
double r74878 = r74867 * r74867;
double r74879 = r74877 + r74878;
double r74880 = r74876 - r74867;
double r74881 = r74876 + r74867;
double r74882 = r74880 * r74881;
double r74883 = r74879 / r74882;
double r74884 = r74875 / r74883;
double r74885 = 544484586544869.0;
double r74886 = 1.425762693006936e+191;
double r74887 = r74885 / r74886;
bool r74888 = r74867 <= r74887;
double r74889 = exp(r74875);
double r74890 = log(r74889);
double r74891 = r74880 * r74876;
double r74892 = r74880 * r74867;
double r74893 = r74891 + r74892;
double r74894 = r74893 / r74879;
double r74895 = exp(r74894);
double r74896 = log(r74895);
double r74897 = r74888 ? r74890 : r74896;
double r74898 = r74874 ? r74884 : r74897;
double r74899 = r74869 ? r74870 : r74898;
return r74899;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.5 |
|---|---|
| Target | 0.0 |
| Herbie | 5.0 |
if y < -5.3752784922532734e+150Initial program 62.7
rmApplied clear-num62.7
Taylor expanded around 0 0
if -5.3752784922532734e+150 < y < -8.743307936790759e-162Initial program 0.0
rmApplied clear-num0.1
if -8.743307936790759e-162 < y < 3.81890050297606e-177Initial program 30.1
rmApplied distribute-lft-in30.1
rmApplied add-log-exp30.1
Taylor expanded around inf 14.8
if 3.81890050297606e-177 < y Initial program 3.0
rmApplied distribute-lft-in3.0
rmApplied add-log-exp3.0
Final simplification5.0
herbie shell --seed 2019304
(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))))