\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3379792666689724 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -6.704752375070274 \cdot 10^{-156}:\\
\;\;\;\;\log \left(e^{\frac{x \cdot x}{x \cdot x + y \cdot y} - \frac{y \cdot y}{x \cdot x + y \cdot y}}\right)\\
\mathbf{elif}\;y \le 4.0567724911730275 \cdot 10^{-165}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{x \cdot x}{x \cdot x + y \cdot y} - \frac{y \cdot y}{x \cdot x + y \cdot y}}\right)\\
\end{array}double f(double x, double y) {
double r1249013 = x;
double r1249014 = y;
double r1249015 = r1249013 - r1249014;
double r1249016 = r1249013 + r1249014;
double r1249017 = r1249015 * r1249016;
double r1249018 = r1249013 * r1249013;
double r1249019 = r1249014 * r1249014;
double r1249020 = r1249018 + r1249019;
double r1249021 = r1249017 / r1249020;
return r1249021;
}
double f(double x, double y) {
double r1249022 = y;
double r1249023 = -1.3379792666689724e+154;
bool r1249024 = r1249022 <= r1249023;
double r1249025 = -1.0;
double r1249026 = -6.704752375070274e-156;
bool r1249027 = r1249022 <= r1249026;
double r1249028 = x;
double r1249029 = r1249028 * r1249028;
double r1249030 = r1249022 * r1249022;
double r1249031 = r1249029 + r1249030;
double r1249032 = r1249029 / r1249031;
double r1249033 = r1249030 / r1249031;
double r1249034 = r1249032 - r1249033;
double r1249035 = exp(r1249034);
double r1249036 = log(r1249035);
double r1249037 = 4.0567724911730275e-165;
bool r1249038 = r1249022 <= r1249037;
double r1249039 = 1.0;
double r1249040 = r1249038 ? r1249039 : r1249036;
double r1249041 = r1249027 ? r1249036 : r1249040;
double r1249042 = r1249024 ? r1249025 : r1249041;
return r1249042;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.3 |
|---|---|
| Target | 0.1 |
| Herbie | 5.3 |
if y < -1.3379792666689724e+154Initial program 63.6
Taylor expanded around 0 0
if -1.3379792666689724e+154 < y < -6.704752375070274e-156 or 4.0567724911730275e-165 < y Initial program 0.2
rmApplied add-log-exp0.2
Simplified0.2
if -6.704752375070274e-156 < y < 4.0567724911730275e-165Initial program 30.5
rmApplied add-log-exp30.5
Simplified30.5
Taylor expanded around -inf 16.4
Final simplification5.3
herbie shell --seed 2019152
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 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))))