\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 \cdot x \le 5.17370770179536029 \cdot 10^{-272}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 2.4428144053544969 \cdot 10^{-230}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{x \cdot x - \left(y \cdot 4\right) \cdot y}}\\
\mathbf{elif}\;x \cdot x \le 5.91172502428276112 \cdot 10^{-212}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 1.8714042555935421 \cdot 10^{-176}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{x \cdot x - \left(y \cdot 4\right) \cdot y}}\\
\mathbf{elif}\;x \cdot x \le 8.29735288633369066 \cdot 10^{-53}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 2.90550718250568474 \cdot 10^{226}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{x \cdot x - \left(y \cdot 4\right) \cdot y}}\\
\mathbf{elif}\;x \cdot x \le 1.0347887184723732 \cdot 10^{274}:\\
\;\;\;\;-1\\
\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 * x) <= 5.17370770179536e-272)) {
VAR = -1.0;
} else {
double VAR_1;
if (((x * x) <= 2.442814405354497e-230)) {
VAR_1 = (1.0 / (((x * x) + ((y * 4.0) * y)) / ((x * x) - ((y * 4.0) * y))));
} else {
double VAR_2;
if (((x * x) <= 5.911725024282761e-212)) {
VAR_2 = -1.0;
} else {
double VAR_3;
if (((x * x) <= 1.871404255593542e-176)) {
VAR_3 = (1.0 / (((x * x) + ((y * 4.0) * y)) / ((x * x) - ((y * 4.0) * y))));
} else {
double VAR_4;
if (((x * x) <= 8.297352886333691e-53)) {
VAR_4 = -1.0;
} else {
double VAR_5;
if (((x * x) <= 2.905507182505685e+226)) {
VAR_5 = (1.0 / (((x * x) + ((y * 4.0) * y)) / ((x * x) - ((y * 4.0) * y))));
} else {
double VAR_6;
if (((x * x) <= 1.0347887184723732e+274)) {
VAR_6 = -1.0;
} 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.5 |
|---|---|
| Target | 31.2 |
| Herbie | 13.8 |
if (* x x) < 5.17370770179536e-272 or 2.442814405354497e-230 < (* x x) < 5.911725024282761e-212 or 1.871404255593542e-176 < (* x x) < 8.297352886333691e-53 or 2.905507182505685e+226 < (* x x) < 1.0347887184723732e+274Initial program 24.7
Taylor expanded around 0 16.5
if 5.17370770179536e-272 < (* x x) < 2.442814405354497e-230 or 5.911725024282761e-212 < (* x x) < 1.871404255593542e-176 or 8.297352886333691e-53 < (* x x) < 2.905507182505685e+226Initial program 14.2
rmApplied clear-num14.2
if 1.0347887184723732e+274 < (* x x) Initial program 59.0
Taylor expanded around inf 9.4
Final simplification13.8
herbie shell --seed 2020091
(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))))