\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -3.847434879443193393633321330852372755378 \cdot 10^{151}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.694063246808970668811003130641552295003 \cdot 10^{-162}:\\
\;\;\;\;\log \left(e^{\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}}\right)\\
\mathbf{elif}\;y \le 6.451959238219760281097758056287369172736 \cdot 10^{-208}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 1.336866892806927934140174920733392856435 \cdot 10^{-166}:\\
\;\;\;\;-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 r103457 = x;
double r103458 = y;
double r103459 = r103457 - r103458;
double r103460 = r103457 + r103458;
double r103461 = r103459 * r103460;
double r103462 = r103457 * r103457;
double r103463 = r103458 * r103458;
double r103464 = r103462 + r103463;
double r103465 = r103461 / r103464;
return r103465;
}
double f(double x, double y) {
double r103466 = y;
double r103467 = -3.8474348794431934e+151;
bool r103468 = r103466 <= r103467;
double r103469 = -1.0;
double r103470 = -1.6940632468089707e-162;
bool r103471 = r103466 <= r103470;
double r103472 = x;
double r103473 = r103472 - r103466;
double r103474 = r103472 + r103466;
double r103475 = r103473 * r103474;
double r103476 = r103472 * r103472;
double r103477 = r103466 * r103466;
double r103478 = r103476 + r103477;
double r103479 = r103475 / r103478;
double r103480 = exp(r103479);
double r103481 = log(r103480);
double r103482 = 6.45195923821976e-208;
bool r103483 = r103466 <= r103482;
double r103484 = 1.0;
double r103485 = 1.336866892806928e-166;
bool r103486 = r103466 <= r103485;
double r103487 = r103486 ? r103469 : r103481;
double r103488 = r103483 ? r103484 : r103487;
double r103489 = r103471 ? r103481 : r103488;
double r103490 = r103468 ? r103469 : r103489;
return r103490;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.6 |
|---|---|
| Target | 0.0 |
| Herbie | 5.5 |
if y < -3.8474348794431934e+151 or 6.45195923821976e-208 < y < 1.336866892806928e-166Initial program 55.7
Taylor expanded around 0 8.5
if -3.8474348794431934e+151 < y < -1.6940632468089707e-162 or 1.336866892806928e-166 < y Initial program 0.3
rmApplied add-log-exp0.3
if -1.6940632468089707e-162 < y < 6.45195923821976e-208Initial program 28.7
rmApplied flip-+28.7
Applied associate-*r/41.6
Applied associate-/l/41.4
Taylor expanded around inf 13.4
Final simplification5.5
herbie shell --seed 2019353
(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))))