\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 \leq -3.995380480633996 \cdot 10^{+123}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1.2067715500681638 \cdot 10^{+88}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq -5.05065600910573 \cdot 10^{+15}:\\
\;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{elif}\;x \leq -13723700.876419608:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq -9.32126470587108 \cdot 10^{-56}:\\
\;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{elif}\;x \leq 6.981857572502039 \cdot 10^{-117}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 2.9610168666493824 \cdot 10^{+147}:\\
\;\;\;\;\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 (<= x -3.995380480633996e+123)
1.0
(if (<= x -1.2067715500681638e+88)
-1.0
(if (<= x -5.05065600910573e+15)
(/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0))))
(if (<= x -13723700.876419608)
-1.0
(if (<= x -9.32126470587108e-56)
(/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0))))
(if (<= x 6.981857572502039e-117)
-1.0
(if (<= x 2.9610168666493824e+147)
(/
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 (x <= -3.995380480633996e+123) {
tmp = 1.0;
} else if (x <= -1.2067715500681638e+88) {
tmp = -1.0;
} else if (x <= -5.05065600910573e+15) {
tmp = ((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)));
} else if (x <= -13723700.876419608) {
tmp = -1.0;
} else if (x <= -9.32126470587108e-56) {
tmp = ((x * x) - (y * (y * 4.0))) / ((x * x) + (y * (y * 4.0)));
} else if (x <= 6.981857572502039e-117) {
tmp = -1.0;
} else if (x <= 2.9610168666493824e+147) {
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.9 |
|---|---|
| Target | 31.6 |
| Herbie | 13.2 |
if x < -3.9953804806339959e123 or 2.96101686664938239e147 < x Initial program 58.9
Taylor expanded around inf 8.6
if -3.9953804806339959e123 < x < -1.20677155006816383e88 or -5050656009105730 < x < -13723700.876419608 or -9.3212647058710807e-56 < x < 6.98185757250203928e-117Initial program 25.6
Taylor expanded around 0 14.1
if -1.20677155006816383e88 < x < -5050656009105730 or -13723700.876419608 < x < -9.3212647058710807e-56Initial program 16.2
if 6.98185757250203928e-117 < x < 2.96101686664938239e147Initial program 16.1
rmApplied clear-num_binary64_1098916.1
Simplified16.1
Final simplification13.2
herbie shell --seed 2020354
(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))))