\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 \leq 9.0166980366027 \cdot 10^{-321}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 1.913632195396027 \cdot 10^{-189}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\right)}^{3}}\\
\mathbf{elif}\;x \cdot x \leq 3.544760866850198 \cdot 10^{-134}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 4.76257875583899 \cdot 10^{+191}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\right)}^{3}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double code(double x, double y) {
return (((double) (((double) (x * x)) - ((double) (((double) (y * 4.0)) * y)))) / ((double) (((double) (x * x)) + ((double) (((double) (y * 4.0)) * y)))));
}
double code(double x, double y) {
double VAR;
if ((((double) (x * x)) <= 9.0166980366027e-321)) {
VAR = -1.0;
} else {
double VAR_1;
if ((((double) (x * x)) <= 1.913632195396027e-189)) {
VAR_1 = ((double) cbrt(((double) pow((((double) (((double) (x * x)) - ((double) (y * ((double) (y * 4.0)))))) / ((double) (((double) (x * x)) + ((double) (y * ((double) (y * 4.0))))))), 3.0))));
} else {
double VAR_2;
if ((((double) (x * x)) <= 3.544760866850198e-134)) {
VAR_2 = -1.0;
} else {
double VAR_3;
if ((((double) (x * x)) <= 4.76257875583899e+191)) {
VAR_3 = ((double) cbrt(((double) pow((((double) (((double) (x * x)) - ((double) (y * ((double) (y * 4.0)))))) / ((double) (((double) (x * x)) + ((double) (y * ((double) (y * 4.0))))))), 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 | 31.6 |
|---|---|
| Target | 31.3 |
| Herbie | 12.5 |
if (* x x) < 9.0167e-321 or 1.9136321953960272e-189 < (* x x) < 3.54476086685019787e-134Initial program Error: 29.3 bits
Taylor expanded around 0 Error: 10.3 bits
if 9.0167e-321 < (* x x) < 1.9136321953960272e-189 or 3.54476086685019787e-134 < (* x x) < 4.7625787558389901e191Initial program Error: 15.7 bits
rmApplied add-cbrt-cubeError: 42.2 bits
Applied add-cbrt-cubeError: 42.5 bits
Applied cbrt-undivError: 42.5 bits
SimplifiedError: 15.7 bits
if 4.7625787558389901e191 < (* x x) Initial program Error: 50.3 bits
Taylor expanded around inf Error: 10.8 bits
Final simplificationError: 12.5 bits
herbie shell --seed 2020200
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))