\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 -3.31141329817743227 \cdot 10^{130}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -6.9699508439260106 \cdot 10^{-99}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + \left(y \cdot 4\right) \cdot y} - \frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;y \le 3.4426870033043312 \cdot 10^{-70}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 1.5581991650942762 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt[3]{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \sqrt[3]{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}\right) \cdot \sqrt[3]{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}}\\
\mathbf{elif}\;y \le 33120927224723735000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 1.10885773604264107 \cdot 10^{54}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + \left(y \cdot 4\right) \cdot y} - \frac{\left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;y \le 1.36256779205199092 \cdot 10^{79}:\\
\;\;\;\;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 ((y <= -3.3114132981774323e+130)) {
VAR = -1.0;
} else {
double VAR_1;
if ((y <= -6.969950843926011e-99)) {
VAR_1 = (((x * x) / ((x * x) + ((y * 4.0) * y))) - (((y * 4.0) * y) / ((x * x) + ((y * 4.0) * y))));
} else {
double VAR_2;
if ((y <= 3.442687003304331e-70)) {
VAR_2 = 1.0;
} else {
double VAR_3;
if ((y <= 1.5581991650942762e-21)) {
VAR_3 = ((cbrt((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)))) * cbrt((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y))))) * cbrt((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)))));
} else {
double VAR_4;
if ((y <= 3.3120927224723735e+19)) {
VAR_4 = 1.0;
} else {
double VAR_5;
if ((y <= 1.108857736042641e+54)) {
VAR_5 = (((x * x) / ((x * x) + ((y * 4.0) * y))) - (((y * 4.0) * y) / ((x * x) + ((y * 4.0) * y))));
} else {
double VAR_6;
if ((y <= 1.362567792051991e+79)) {
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.1 |
|---|---|
| Target | 30.8 |
| Herbie | 13.7 |
if y < -3.3114132981774323e+130 or 1.362567792051991e+79 < y Initial program 52.3
Taylor expanded around 0 11.5
if -3.3114132981774323e+130 < y < -6.969950843926011e-99 or 3.3120927224723735e+19 < y < 1.108857736042641e+54Initial program 14.7
rmApplied div-sub14.7
if -6.969950843926011e-99 < y < 3.442687003304331e-70 or 1.5581991650942762e-21 < y < 3.3120927224723735e+19 or 1.108857736042641e+54 < y < 1.362567792051991e+79Initial program 24.3
Taylor expanded around inf 14.6
if 3.442687003304331e-70 < y < 1.5581991650942762e-21Initial program 17.0
rmApplied add-cube-cbrt17.0
Final simplification13.7
herbie shell --seed 2020106
(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))))