\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 -4.41949527347075 \cdot 10^{+131}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -3.092213754992166 \cdot 10^{-158}:\\
\;\;\;\;\log \left(e^{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}}\right)\\
\mathbf{elif}\;y \leq 8.71219008979303 \cdot 10^{+20}:\\
\;\;\;\;1\\
\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 -4.41949527347075e+131)
-1.0
(if (<= y -3.092213754992166e-158)
(log (exp (/ (- (* x x) (* y (* y 4.0))) (+ (* x x) (* y (* y 4.0))))))
(if (<= y 8.71219008979303e+20) 1.0 -1.0))))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 tmp;
if ((y <= -4.41949527347075e+131)) {
tmp = -1.0;
} else {
double tmp_1;
if ((y <= -3.092213754992166e-158)) {
tmp_1 = ((double) log(((double) exp((((double) (((double) (x * x)) - ((double) (y * ((double) (y * 4.0)))))) / ((double) (((double) (x * x)) + ((double) (y * ((double) (y * 4.0)))))))))));
} else {
double tmp_2;
if ((y <= 8.71219008979303e+20)) {
tmp_2 = 1.0;
} else {
tmp_2 = -1.0;
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.9 |
|---|---|
| Target | 31.6 |
| Herbie | 14.3 |
if y < -4.41949527347074966e131 or 871219008979303006000 < y Initial program Error: 47.9 bits
Taylor expanded around 0 Error: 12.7 bits
if -4.41949527347074966e131 < y < -3.09221375499216593e-158Initial program Error: 16.2 bits
rmApplied add-log-expError: 16.2 bits
SimplifiedError: 16.2 bits
if -3.09221375499216593e-158 < y < 871219008979303006000Initial program Error: 25.9 bits
Taylor expanded around inf Error: 14.6 bits
Final simplificationError: 14.3 bits
herbie shell --seed 2020203
(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))))