\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}\;x \le -3.22011096454309528 \cdot 10^{205}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -3.4425921643712863 \cdot 10^{190}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le -2.63068118997058504 \cdot 10^{141}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -3.3639004184692263 \cdot 10^{-161}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \sqrt{4}, \left|x\right|\right) \cdot \mathsf{fma}\left(-\sqrt{4}, y, \left|x\right|\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;x \le 1.1393370701449459 \cdot 10^{-92}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 2.4947948969068313 \cdot 10^{60}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \sqrt{4}, \left|x\right|\right) \cdot \mathsf{fma}\left(-\sqrt{4}, y, \left|x\right|\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;x \le 3.73657933459427146 \cdot 10^{84}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 4.58724200356930738 \cdot 10^{101}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \sqrt{4}, \left|x\right|\right) \cdot \mathsf{fma}\left(-\sqrt{4}, y, \left|x\right|\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double code(double x, double y) {
return (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
}
double code(double x, double y) {
double temp;
if ((x <= -3.2201109645430953e+205)) {
temp = 1.0;
} else {
double temp_1;
if ((x <= -3.4425921643712863e+190)) {
temp_1 = -1.0;
} else {
double temp_2;
if ((x <= -2.630681189970585e+141)) {
temp_2 = 1.0;
} else {
double temp_3;
if ((x <= -3.3639004184692263e-161)) {
temp_3 = ((fma(y, sqrt(4.0), fabs(x)) * fma(-sqrt(4.0), y, fabs(x))) / ((x * x) + ((y * 4.0) * y)));
} else {
double temp_4;
if ((x <= 1.1393370701449459e-92)) {
temp_4 = -1.0;
} else {
double temp_5;
if ((x <= 2.4947948969068313e+60)) {
temp_5 = ((fma(y, sqrt(4.0), fabs(x)) * fma(-sqrt(4.0), y, fabs(x))) / ((x * x) + ((y * 4.0) * y)));
} else {
double temp_6;
if ((x <= 3.7365793345942715e+84)) {
temp_6 = -1.0;
} else {
double temp_7;
if ((x <= 4.5872420035693074e+101)) {
temp_7 = ((fma(y, sqrt(4.0), fabs(x)) * fma(-sqrt(4.0), y, fabs(x))) / ((x * x) + ((y * 4.0) * y)));
} else {
temp_7 = 1.0;
}
temp_6 = temp_7;
}
temp_5 = temp_6;
}
temp_4 = temp_5;
}
temp_3 = temp_4;
}
temp_2 = temp_3;
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.5 |
|---|---|
| Target | 31.2 |
| Herbie | 13.3 |
if x < -3.2201109645430953e+205 or -3.4425921643712863e+190 < x < -2.630681189970585e+141 or 4.5872420035693074e+101 < x Initial program 55.3
Taylor expanded around inf 9.1
if -3.2201109645430953e+205 < x < -3.4425921643712863e+190 or -3.3639004184692263e-161 < x < 1.1393370701449459e-92 or 2.4947948969068313e+60 < x < 3.7365793345942715e+84Initial program 28.3
Taylor expanded around 0 14.0
if -2.630681189970585e+141 < x < -3.3639004184692263e-161 or 1.1393370701449459e-92 < x < 2.4947948969068313e+60 or 3.7365793345942715e+84 < x < 4.5872420035693074e+101Initial program 16.0
rmApplied add-sqr-sqrt40.0
Applied add-sqr-sqrt40.0
Applied add-sqr-sqrt40.1
Applied unswap-sqr40.1
Applied unswap-sqr40.1
Applied add-sqr-sqrt40.1
Applied difference-of-squares40.1
Simplified40.0
Simplified16.0
Final simplification13.3
herbie shell --seed 2020066 +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))))