\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 \leq -1.488250446643674 \cdot 10^{+153}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -1.5577763859929083 \cdot 10^{-113}:\\
\;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{elif}\;y \leq 2.0147544608758084 \cdot 10^{-21}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.0766145445783297 \cdot 10^{+65}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot \left(y \cdot 4\right)}{x \cdot x - y \cdot \left(y \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}(FPCore (x y) :precision binary64 (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))
(FPCore (x y)
:precision binary64
(if (<= y -1.488250446643674e+153)
-1.0
(if (<= y -1.5577763859929083e-113)
(/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0))))
(if (<= y 2.0147544608758084e-21)
1.0
(if (<= y 2.0766145445783297e+65)
(/ 1.0 (/ (+ (* x x) (* y (* y 4.0))) (- (* x x) (* y (* y 4.0)))))
-1.0)))))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 tmp;
if (y <= -1.488250446643674e+153) {
tmp = -1.0;
} else if (y <= -1.5577763859929083e-113) {
tmp = ((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)));
} else if (y <= 2.0147544608758084e-21) {
tmp = 1.0;
} else if (y <= 2.0766145445783297e+65) {
tmp = 1.0 / (((x * x) + (y * (y * 4.0))) / ((x * x) - (y * (y * 4.0))));
} else {
tmp = -1.0;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.5 |
|---|---|
| Target | 31.2 |
| Herbie | 13.0 |
if y < -1.48825044664367404e153 or 2.0766145445783297e65 < y Initial program 52.8
Taylor expanded around 0 10.5
if -1.48825044664367404e153 < y < -1.5577763859929083e-113Initial program 16.0
if -1.5577763859929083e-113 < y < 2.0147544608758084e-21Initial program 25.4
Taylor expanded around inf 12.8
if 2.0147544608758084e-21 < y < 2.0766145445783297e65Initial program 16.4
rmApplied clear-num_binary64_1712716.4
Simplified16.4
Final simplification13.0
herbie shell --seed 2021007
(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))))