\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 -4.5422239760964022 \cdot 10^{172}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.58062656605551297 \cdot 10^{-97}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{y}}\\
\mathbf{elif}\;y \le 1.19856641460827694 \cdot 10^{-62}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 2.05879739523357 \cdot 10^{107}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{y}}\\
\mathbf{elif}\;y \le 2.49672079982528521 \cdot 10^{132}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r722690 = x;
double r722691 = r722690 * r722690;
double r722692 = y;
double r722693 = 4.0;
double r722694 = r722692 * r722693;
double r722695 = r722694 * r722692;
double r722696 = r722691 - r722695;
double r722697 = r722691 + r722695;
double r722698 = r722696 / r722697;
return r722698;
}
double f(double x, double y) {
double r722699 = y;
double r722700 = -4.542223976096402e+172;
bool r722701 = r722699 <= r722700;
double r722702 = -1.0;
double r722703 = -1.580626566055513e-97;
bool r722704 = r722699 <= r722703;
double r722705 = x;
double r722706 = 4.0;
double r722707 = r722699 * r722706;
double r722708 = r722707 * r722699;
double r722709 = fma(r722705, r722705, r722708);
double r722710 = r722709 / r722705;
double r722711 = r722705 / r722710;
double r722712 = r722709 / r722699;
double r722713 = r722707 / r722712;
double r722714 = r722711 - r722713;
double r722715 = 1.198566414608277e-62;
bool r722716 = r722699 <= r722715;
double r722717 = 1.0;
double r722718 = 2.0587973952335703e+107;
bool r722719 = r722699 <= r722718;
double r722720 = 2.4967207998252852e+132;
bool r722721 = r722699 <= r722720;
double r722722 = r722721 ? r722717 : r722702;
double r722723 = r722719 ? r722714 : r722722;
double r722724 = r722716 ? r722717 : r722723;
double r722725 = r722704 ? r722714 : r722724;
double r722726 = r722701 ? r722702 : r722725;
return r722726;
}




Bits error versus x




Bits error versus y
| Original | 32.3 |
|---|---|
| Target | 32.0 |
| Herbie | 13.5 |
if y < -4.542223976096402e+172 or 2.4967207998252852e+132 < y Initial program 60.7
Taylor expanded around 0 7.6
if -4.542223976096402e+172 < y < -1.580626566055513e-97 or 1.198566414608277e-62 < y < 2.0587973952335703e+107Initial program 18.3
rmApplied div-sub18.3
Simplified17.9
Simplified17.8
if -1.580626566055513e-97 < y < 1.198566414608277e-62 or 2.0587973952335703e+107 < y < 2.4967207998252852e+132Initial program 25.8
Taylor expanded around inf 13.5
Final simplification13.5
herbie shell --seed 2020047 +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))))