\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -2.0372639617288886 \cdot 10^{151}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -3.3928899832237578 \cdot 10^{-156}:\\
\;\;\;\;\frac{x \cdot x - y \cdot y}{\sqrt{x \cdot x + y \cdot y} \cdot \left(x + y\right)} \cdot \frac{x + y}{\sqrt{x \cdot x + y \cdot y}}\\
\mathbf{elif}\;y \le 9.3207497238124358 \cdot 10^{-170}:\\
\;\;\;\;\log \left(e^{1}\right)\\
\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 r74778 = x;
double r74779 = y;
double r74780 = r74778 - r74779;
double r74781 = r74778 + r74779;
double r74782 = r74780 * r74781;
double r74783 = r74778 * r74778;
double r74784 = r74779 * r74779;
double r74785 = r74783 + r74784;
double r74786 = r74782 / r74785;
return r74786;
}
double f(double x, double y) {
double r74787 = y;
double r74788 = -2.0372639617288886e+151;
bool r74789 = r74787 <= r74788;
double r74790 = -1.0;
double r74791 = -3.392889983223758e-156;
bool r74792 = r74787 <= r74791;
double r74793 = x;
double r74794 = r74793 * r74793;
double r74795 = r74787 * r74787;
double r74796 = r74794 - r74795;
double r74797 = r74794 + r74795;
double r74798 = sqrt(r74797);
double r74799 = r74793 + r74787;
double r74800 = r74798 * r74799;
double r74801 = r74796 / r74800;
double r74802 = r74799 / r74798;
double r74803 = r74801 * r74802;
double r74804 = 9.320749723812436e-170;
bool r74805 = r74787 <= r74804;
double r74806 = 1.0;
double r74807 = exp(r74806);
double r74808 = log(r74807);
double r74809 = r74793 - r74787;
double r74810 = r74809 * r74799;
double r74811 = r74810 / r74797;
double r74812 = exp(r74811);
double r74813 = log(r74812);
double r74814 = r74805 ? r74808 : r74813;
double r74815 = r74792 ? r74803 : r74814;
double r74816 = r74789 ? r74790 : r74815;
return r74816;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.6 |
|---|---|
| Target | 0.1 |
| Herbie | 5.3 |
if y < -2.0372639617288886e+151Initial program 63.2
Taylor expanded around 0 0
if -2.0372639617288886e+151 < y < -3.392889983223758e-156Initial program 0.0
rmApplied add-sqr-sqrt0.0
Applied times-frac0.0
rmApplied flip--0.1
Applied associate-/l/0.0
if -3.392889983223758e-156 < y < 9.320749723812436e-170Initial program 30.3
rmApplied add-log-exp30.3
Taylor expanded around inf 15.9
if 9.320749723812436e-170 < y Initial program 1.3
rmApplied add-log-exp1.3
Final simplification5.3
herbie shell --seed 2020056
(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))))