\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 -8.0100088126846216 \cdot 10^{156}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -2.0748864680147525 \cdot 10^{-158}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\mathsf{fma}\left(4, y, \frac{{x}^{2}}{y}\right)}\\
\mathbf{elif}\;x \le 1.5742312129132485 \cdot 10^{-162}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 1.169381707710022 \cdot 10^{142}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\mathsf{fma}\left(4, y, \frac{{x}^{2}}{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}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 VAR;
if ((x <= -8.010008812684622e+156)) {
VAR = 1.0;
} else {
double VAR_1;
if ((x <= -2.0748864680147525e-158)) {
VAR_1 = ((x / (fma(x, x, ((y * 4.0) * y)) / x)) - ((y * 4.0) / fma(4.0, y, (pow(x, 2.0) / y))));
} else {
double VAR_2;
if ((x <= 1.5742312129132485e-162)) {
VAR_2 = -1.0;
} else {
double VAR_3;
if ((x <= 1.169381707710022e+142)) {
VAR_3 = ((x / (fma(x, x, ((y * 4.0) * y)) / x)) - ((y * 4.0) / fma(4.0, y, (pow(x, 2.0) / y))));
} 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.5 |
|---|---|
| Target | 31.2 |
| Herbie | 4.4 |
if x < -8.010008812684622e+156 or 1.169381707710022e+142 < x Initial program 62.1
Taylor expanded around inf 8.6
if -8.010008812684622e+156 < x < -2.0748864680147525e-158 or 1.5742312129132485e-162 < x < 1.169381707710022e+142Initial program 15.2
rmApplied div-sub15.2
Simplified15.4
Simplified14.9
Taylor expanded around 0 0.6
Simplified0.6
if -2.0748864680147525e-158 < x < 1.5742312129132485e-162Initial program 31.4
Taylor expanded around 0 7.7
Final simplification4.4
herbie shell --seed 2020091 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< (/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4))) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4)))) 2) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))))
(/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))))