\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 4.62860521086858958 \cdot 10^{-182}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 2.08191304081905237 \cdot 10^{-41}:\\
\;\;\;\;\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.23303926919671843 \cdot 10^{-11}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 5.4237368993854683 \cdot 10^{116}:\\
\;\;\;\;\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{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 * x) <= 4.6286052108685896e-182)) {
temp = -1.0;
} else {
double temp_1;
if (((x * x) <= 2.0819130408190524e-41)) {
temp_1 = (((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y)));
} else {
double temp_2;
if (((x * x) <= 1.2330392691967184e-11)) {
temp_2 = -1.0;
} else {
double temp_3;
if (((x * x) <= 5.423736899385468e+116)) {
temp_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 {
temp_3 = 1.0;
}
temp_2 = temp_3;
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.8 |
|---|---|
| Target | 31.5 |
| Herbie | 13.4 |
if (* x x) < 4.6286052108685896e-182 or 2.0819130408190524e-41 < (* x x) < 1.2330392691967184e-11Initial program 25.1
Taylor expanded around 0 12.6
if 4.6286052108685896e-182 < (* x x) < 2.0819130408190524e-41Initial program 15.8
if 1.2330392691967184e-11 < (* x x) < 5.423736899385468e+116Initial program 15.7
rmApplied add-cube-cbrt15.7
if 5.423736899385468e+116 < (* x x) Initial program 46.0
Taylor expanded around inf 13.0
Final simplification13.4
herbie shell --seed 2020058
(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))))