\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 \cdot x \le 8.48677548777607887 \cdot 10^{-264}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 2.1340718332425224 \cdot 10^{-245}:\\
\;\;\;\;\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{elif}\;x \cdot x \le 2.7325230911480087 \cdot 10^{-173}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 4.68601800110195913 \cdot 10^{264}:\\
\;\;\;\;\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r662887 = x;
double r662888 = r662887 * r662887;
double r662889 = y;
double r662890 = 4.0;
double r662891 = r662889 * r662890;
double r662892 = r662891 * r662889;
double r662893 = r662888 - r662892;
double r662894 = r662888 + r662892;
double r662895 = r662893 / r662894;
return r662895;
}
double f(double x, double y) {
double r662896 = x;
double r662897 = r662896 * r662896;
double r662898 = 8.486775487776079e-264;
bool r662899 = r662897 <= r662898;
double r662900 = -1.0;
double r662901 = 2.1340718332425224e-245;
bool r662902 = r662897 <= r662901;
double r662903 = y;
double r662904 = 4.0;
double r662905 = r662903 * r662904;
double r662906 = r662905 * r662903;
double r662907 = r662897 - r662906;
double r662908 = r662897 + r662906;
double r662909 = r662907 / r662908;
double r662910 = 2.7325230911480087e-173;
bool r662911 = r662897 <= r662910;
double r662912 = 4.686018001101959e+264;
bool r662913 = r662897 <= r662912;
double r662914 = 1.0;
double r662915 = r662913 ? r662909 : r662914;
double r662916 = r662911 ? r662900 : r662915;
double r662917 = r662902 ? r662909 : r662916;
double r662918 = r662899 ? r662900 : r662917;
return r662918;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.1 |
|---|---|
| Target | 30.8 |
| Herbie | 12.2 |
if (* x x) < 8.486775487776079e-264 or 2.1340718332425224e-245 < (* x x) < 2.7325230911480087e-173Initial program 26.5
Taylor expanded around 0 11.1
if 8.486775487776079e-264 < (* x x) < 2.1340718332425224e-245 or 2.7325230911480087e-173 < (* x x) < 4.686018001101959e+264Initial program 15.5
if 4.686018001101959e+264 < (* x x) Initial program 57.5
Taylor expanded around inf 9.1
Final simplification12.2
herbie shell --seed 2020045
(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))))