\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -2.22352685318922961 \cdot 10^{254}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -2.62712045946508503 \cdot 10^{212}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le -4.96248021588850455 \cdot 10^{128}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -2.583750869341446 \cdot 10^{60}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le -6.45314904363278403 \cdot 10^{-7}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;y \le 4.22472559063544996 \cdot 10^{-142}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 8.4175975820898431 \cdot 10^{133}:\\
\;\;\;\;\log \left(e^{\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r778706 = x;
double r778707 = r778706 * r778706;
double r778708 = y;
double r778709 = 4.0;
double r778710 = r778708 * r778709;
double r778711 = r778710 * r778708;
double r778712 = r778707 - r778711;
double r778713 = r778707 + r778711;
double r778714 = r778712 / r778713;
return r778714;
}
double f(double x, double y) {
double r778715 = y;
double r778716 = -2.2235268531892296e+254;
bool r778717 = r778715 <= r778716;
double r778718 = -1.0;
double r778719 = -2.627120459465085e+212;
bool r778720 = r778715 <= r778719;
double r778721 = 1.0;
double r778722 = -4.9624802158885046e+128;
bool r778723 = r778715 <= r778722;
double r778724 = -2.5837508693414465e+60;
bool r778725 = r778715 <= r778724;
double r778726 = -6.453149043632784e-07;
bool r778727 = r778715 <= r778726;
double r778728 = x;
double r778729 = r778728 * r778728;
double r778730 = 4.0;
double r778731 = r778715 * r778730;
double r778732 = r778731 * r778715;
double r778733 = fma(r778728, r778728, r778732);
double r778734 = r778729 / r778733;
double r778735 = r778729 + r778732;
double r778736 = r778732 / r778735;
double r778737 = r778734 - r778736;
double r778738 = 4.22472559063545e-142;
bool r778739 = r778715 <= r778738;
double r778740 = 8.417597582089843e+133;
bool r778741 = r778715 <= r778740;
double r778742 = r778732 / r778733;
double r778743 = r778734 - r778742;
double r778744 = exp(r778743);
double r778745 = log(r778744);
double r778746 = r778741 ? r778745 : r778718;
double r778747 = r778739 ? r778721 : r778746;
double r778748 = r778727 ? r778737 : r778747;
double r778749 = r778725 ? r778721 : r778748;
double r778750 = r778723 ? r778718 : r778749;
double r778751 = r778720 ? r778721 : r778750;
double r778752 = r778717 ? r778718 : r778751;
return r778752;
}




Bits error versus x




Bits error versus y
| Original | 31.8 |
|---|---|
| Target | 31.5 |
| Herbie | 16.2 |
if y < -2.2235268531892296e+254 or -2.627120459465085e+212 < y < -4.9624802158885046e+128 or 8.417597582089843e+133 < y Initial program 56.7
Simplified56.7
Taylor expanded around 0 8.8
if -2.2235268531892296e+254 < y < -2.627120459465085e+212 or -4.9624802158885046e+128 < y < -2.5837508693414465e+60 or -6.453149043632784e-07 < y < 4.22472559063545e-142Initial program 27.3
Simplified27.3
Taylor expanded around inf 19.7
if -2.5837508693414465e+60 < y < -6.453149043632784e-07Initial program 16.0
Simplified16.0
rmApplied div-sub16.0
rmApplied fma-udef16.0
if 4.22472559063545e-142 < y < 8.417597582089843e+133Initial program 17.0
Simplified17.0
rmApplied div-sub17.0
rmApplied add-log-exp17.0
Applied add-log-exp17.0
Applied diff-log17.0
Simplified17.0
Final simplification16.2
herbie shell --seed 2020043 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< (/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4))) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4)))) 2) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))))
(/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))))