\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.08310863609937876 \cdot 10^{138}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -1.4247950034871411 \cdot 10^{-65}:\\
\;\;\;\;\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;x \le 5.15744740423650361 \cdot 10^{-136}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 5.8877866093643367 \cdot 10^{-36}:\\
\;\;\;\;\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;x \le 1914785280668363300:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 2.02681147685658205 \cdot 10^{120}:\\
\;\;\;\;\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{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 VAR;
if ((x <= -3.083108636099379e+138)) {
VAR = 1.0;
} else {
double VAR_1;
if ((x <= -1.4247950034871411e-65)) {
VAR_1 = (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
} else {
double VAR_2;
if ((x <= 5.1574474042365036e-136)) {
VAR_2 = -1.0;
} else {
double VAR_3;
if ((x <= 5.887786609364337e-36)) {
VAR_3 = (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
} else {
double VAR_4;
if ((x <= 1.9147852806683633e+18)) {
VAR_4 = -1.0;
} else {
double VAR_5;
if ((x <= 2.026811476856582e+120)) {
VAR_5 = (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
} else {
VAR_5 = 1.0;
}
VAR_4 = VAR_5;
}
VAR_3 = VAR_4;
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 32.1 |
|---|---|
| Target | 31.7 |
| Herbie | 13.7 |
if x < -3.083108636099379e+138 or 2.026811476856582e+120 < x Initial program 58.0
Taylor expanded around inf 10.3
if -3.083108636099379e+138 < x < -1.4247950034871411e-65 or 5.1574474042365036e-136 < x < 5.887786609364337e-36 or 1.9147852806683633e+18 < x < 2.026811476856582e+120Initial program 16.8
if -1.4247950034871411e-65 < x < 5.1574474042365036e-136 or 5.887786609364337e-36 < x < 1.9147852806683633e+18Initial program 25.7
Taylor expanded around 0 13.7
Final simplification13.7
herbie shell --seed 2020078
(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))))