\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}:\\
\;\;\;\;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 r93038 = x;
double r93039 = y;
double r93040 = r93038 - r93039;
double r93041 = r93038 + r93039;
double r93042 = r93040 * r93041;
double r93043 = r93038 * r93038;
double r93044 = r93039 * r93039;
double r93045 = r93043 + r93044;
double r93046 = r93042 / r93045;
return r93046;
}
double f(double x, double y) {
double r93047 = y;
double r93048 = -2.0372639617288886e+151;
bool r93049 = r93047 <= r93048;
double r93050 = -1.0;
double r93051 = -3.392889983223758e-156;
bool r93052 = r93047 <= r93051;
double r93053 = x;
double r93054 = r93053 * r93053;
double r93055 = r93047 * r93047;
double r93056 = r93054 - r93055;
double r93057 = r93054 + r93055;
double r93058 = sqrt(r93057);
double r93059 = r93053 + r93047;
double r93060 = r93058 * r93059;
double r93061 = r93056 / r93060;
double r93062 = r93059 / r93058;
double r93063 = r93061 * r93062;
double r93064 = 9.320749723812436e-170;
bool r93065 = r93047 <= r93064;
double r93066 = 1.0;
double r93067 = r93053 - r93047;
double r93068 = r93067 * r93059;
double r93069 = r93068 / r93057;
double r93070 = exp(r93069);
double r93071 = log(r93070);
double r93072 = r93065 ? r93066 : r93071;
double r93073 = r93052 ? r93063 : r93072;
double r93074 = r93049 ? r93050 : r93073;
return r93074;
}




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
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))))