\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 \le -1.1269686448080675 \cdot 10^{-74}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le 7.454968088927992 \cdot 10^{-107} \lor \neg \left(x \le 1.1264816293584452 \cdot 10^{-96}\right) \land x \le 4.15936032582048784 \cdot 10^{-36}:\\
\;\;\;\;-1\\
\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 ((x <= -1.1269686448080675e-74)) {
VAR = 1.0;
} else {
double VAR_1;
if (((x <= 7.454968088927992e-107) || (!(x <= 1.1264816293584452e-96) && (x <= 4.159360325820488e-36)))) {
VAR_1 = -1.0;
} else {
VAR_1 = 1.0;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.3 |
|---|---|
| Target | 31.0 |
| Herbie | 16.7 |
if x < -1.1269686448080675e-74 or 7.454968088927992e-107 < x < 1.1264816293584452e-96 or 4.15936032582048784e-36 < x Initial program 36.4
Taylor expanded around inf 18.7
if -1.1269686448080675e-74 < x < 7.454968088927992e-107 or 1.1264816293584452e-96 < x < 4.15936032582048784e-36Initial program 24.1
Taylor expanded around 0 13.8
Final simplification16.7
herbie shell --seed 2020181
(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))))