\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 -2.34082694014606577 \cdot 10^{118}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -9.20346477231118837 \cdot 10^{91}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le -2.331107751590961 \cdot 10^{-11}:\\
\;\;\;\;\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 -4.69614509835442959 \cdot 10^{-35}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le -1.05096368820633768 \cdot 10^{-153}:\\
\;\;\;\;\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 4.66038681197601 \cdot 10^{-135}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 6.66837021863772414 \cdot 10^{108}:\\
\;\;\;\;\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 <= -2.3408269401460658e+118)) {
VAR = 1.0;
} else {
double VAR_1;
if ((x <= -9.203464772311188e+91)) {
VAR_1 = -1.0;
} else {
double VAR_2;
if ((x <= -2.331107751590961e-11)) {
VAR_2 = (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
} else {
double VAR_3;
if ((x <= -4.6961450983544296e-35)) {
VAR_3 = -1.0;
} else {
double VAR_4;
if ((x <= -1.0509636882063377e-153)) {
VAR_4 = (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
} else {
double VAR_5;
if ((x <= 4.66038681197601e-135)) {
VAR_5 = -1.0;
} else {
double VAR_6;
if ((x <= 6.668370218637724e+108)) {
VAR_6 = (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
} else {
VAR_6 = 1.0;
}
VAR_5 = VAR_6;
}
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 | 31.6 |
|---|---|
| Target | 31.2 |
| Herbie | 13.1 |
if x < -2.3408269401460658e+118 or 6.668370218637724e+108 < x Initial program 54.6
Taylor expanded around inf 10.2
if -2.3408269401460658e+118 < x < -9.203464772311188e+91 or -2.331107751590961e-11 < x < -4.6961450983544296e-35 or -1.0509636882063377e-153 < x < 4.66038681197601e-135Initial program 27.6
Taylor expanded around 0 11.9
if -9.203464772311188e+91 < x < -2.331107751590961e-11 or -4.6961450983544296e-35 < x < -1.0509636882063377e-153 or 4.66038681197601e-135 < x < 6.668370218637724e+108Initial program 16.3
Final simplification13.1
herbie shell --seed 2020105 +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))))