\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -9.821782313314639955086003839853747327964 \cdot 10^{153}:\\
\;\;\;\;\log \left(e^{-1}\right)\\
\mathbf{elif}\;y \le \frac{-4907405930329829}{2.53266331108459042877954581524118722596 \cdot 10^{176}}:\\
\;\;\;\;\log \left({\left(e^{1}\right)}^{\left(\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\right)}\right)\\
\mathbf{elif}\;y \le \frac{7408587307615215}{4.052261297735344686047273304385899561536 \cdot 10^{177}}:\\
\;\;\;\;\log \left({\left(e^{1}\right)}^{1}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left({\left(e^{1}\right)}^{\left(\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\right)}\right)\\
\end{array}double f(double x, double y) {
double r72855 = x;
double r72856 = y;
double r72857 = r72855 - r72856;
double r72858 = r72855 + r72856;
double r72859 = r72857 * r72858;
double r72860 = r72855 * r72855;
double r72861 = r72856 * r72856;
double r72862 = r72860 + r72861;
double r72863 = r72859 / r72862;
return r72863;
}
double f(double x, double y) {
double r72864 = y;
double r72865 = -9.82178231331464e+153;
bool r72866 = r72864 <= r72865;
double r72867 = -1.0;
double r72868 = exp(r72867);
double r72869 = log(r72868);
double r72870 = -4907405930329829.0;
double r72871 = 2.5326633110845904e+176;
double r72872 = r72870 / r72871;
bool r72873 = r72864 <= r72872;
double r72874 = 1.0;
double r72875 = exp(r72874);
double r72876 = x;
double r72877 = r72876 - r72864;
double r72878 = r72876 + r72864;
double r72879 = r72877 * r72878;
double r72880 = r72876 * r72876;
double r72881 = r72864 * r72864;
double r72882 = r72880 + r72881;
double r72883 = r72879 / r72882;
double r72884 = pow(r72875, r72883);
double r72885 = log(r72884);
double r72886 = 7408587307615215.0;
double r72887 = 4.052261297735345e+177;
double r72888 = r72886 / r72887;
bool r72889 = r72864 <= r72888;
double r72890 = pow(r72875, r72874);
double r72891 = log(r72890);
double r72892 = r72889 ? r72891 : r72885;
double r72893 = r72873 ? r72885 : r72892;
double r72894 = r72866 ? r72869 : r72893;
return r72894;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.9 |
|---|---|
| Target | 0.1 |
| Herbie | 4.6 |
if y < -9.82178231331464e+153Initial program 63.9
rmApplied add-sqr-sqrt63.9
Applied times-frac61.9
rmApplied add-log-exp61.9
Simplified63.9
Taylor expanded around 0 0
if -9.82178231331464e+153 < y < -1.937646393364571e-161 or 1.8282600166370302e-162 < y Initial program 0.0
rmApplied add-sqr-sqrt0.0
Applied times-frac0.5
rmApplied add-log-exp0.5
Simplified0.0
if -1.937646393364571e-161 < y < 1.8282600166370302e-162Initial program 29.7
rmApplied add-sqr-sqrt29.7
Applied times-frac30.2
rmApplied add-log-exp30.2
Simplified29.7
Taylor expanded around inf 14.6
Final simplification4.6
herbie shell --seed 2019303
(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))))