\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}\;\left(y \cdot 4\right) \cdot y \le 1.97626 \cdot 10^{-323}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 1.4188926507855431 \cdot 10^{-113}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\right)}^{3}}\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 2.4050824137629305 \cdot 10^{64}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 2.0904248676491008 \cdot 10^{219}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}\right)}^{3}}\\
\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 * 4.0) * y) <= 1.976262583365e-323)) {
VAR = 1.0;
} else {
double VAR_1;
if ((((y * 4.0) * y) <= 1.418892650785543e-113)) {
VAR_1 = cbrt(pow((((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y))), 3.0));
} else {
double VAR_2;
if ((((y * 4.0) * y) <= 2.4050824137629305e+64)) {
VAR_2 = 1.0;
} else {
double VAR_3;
if ((((y * 4.0) * y) <= 2.0904248676491008e+219)) {
VAR_3 = cbrt(pow(((((x * x) - ((y * 4.0) * y)) / sqrt(((x * x) + ((y * 4.0) * y)))) / sqrt(((x * x) + ((y * 4.0) * y)))), 3.0));
} else {
VAR_3 = -1.0;
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 32.0 |
|---|---|
| Target | 31.7 |
| Herbie | 14.2 |
if (* (* y 4.0) y) < 1.976262583365e-323 or 1.418892650785543e-113 < (* (* y 4.0) y) < 2.4050824137629305e+64Initial program 26.1
Taylor expanded around inf 16.1
if 1.976262583365e-323 < (* (* y 4.0) y) < 1.418892650785543e-113Initial program 15.4
rmApplied add-cbrt-cube52.7
Applied add-cbrt-cube52.8
Applied cbrt-undiv52.8
Simplified15.4
if 2.4050824137629305e+64 < (* (* y 4.0) y) < 2.0904248676491008e+219Initial program 16.3
rmApplied add-cbrt-cube52.3
Applied add-cbrt-cube53.4
Applied cbrt-undiv53.4
Simplified16.3
rmApplied add-sqr-sqrt16.3
Applied associate-/r*16.3
if 2.0904248676491008e+219 < (* (* y 4.0) y) Initial program 53.1
Taylor expanded around 0 10.6
Final simplification14.2
herbie shell --seed 2020103
(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))))