\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3434000592863123 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -8.556032821094931 \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 2.1804237440776019 \cdot 10^{-162}:\\
\;\;\;\;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 r1604143 = x;
double r1604144 = y;
double r1604145 = r1604143 - r1604144;
double r1604146 = r1604143 + r1604144;
double r1604147 = r1604145 * r1604146;
double r1604148 = r1604143 * r1604143;
double r1604149 = r1604144 * r1604144;
double r1604150 = r1604148 + r1604149;
double r1604151 = r1604147 / r1604150;
return r1604151;
}
double f(double x, double y) {
double r1604152 = y;
double r1604153 = -1.3434000592863123e+154;
bool r1604154 = r1604152 <= r1604153;
double r1604155 = -1.0;
double r1604156 = -8.556032821094931e-156;
bool r1604157 = r1604152 <= r1604156;
double r1604158 = x;
double r1604159 = r1604158 * r1604158;
double r1604160 = r1604152 * r1604152;
double r1604161 = r1604159 + r1604160;
double r1604162 = r1604159 / r1604161;
double r1604163 = r1604160 / r1604161;
double r1604164 = r1604162 - r1604163;
double r1604165 = exp(r1604164);
double r1604166 = log(r1604165);
double r1604167 = 2.1804237440776019e-162;
bool r1604168 = r1604152 <= r1604167;
double r1604169 = 1.0;
double r1604170 = r1604168 ? r1604169 : r1604166;
double r1604171 = r1604157 ? r1604166 : r1604170;
double r1604172 = r1604154 ? r1604155 : r1604171;
return r1604172;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.2 |
|---|---|
| Target | 0.0 |
| Herbie | 5.1 |
if y < -1.3434000592863123e+154Initial program 63.6
Simplified63.6
rmApplied add-log-exp63.6
Taylor expanded around 0 0
if -1.3434000592863123e+154 < y < -8.556032821094931e-156 or 2.1804237440776019e-162 < y Initial program 0.0
Simplified0.0
rmApplied add-log-exp0.0
if -8.556032821094931e-156 < y < 2.1804237440776019e-162Initial program 29.2
Simplified29.2
Taylor expanded around -inf 15.7
Final simplification5.1
herbie shell --seed 2019133
(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))))