\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 -1.331887172847139076544407291057659922741 \cdot 10^{154}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -1.570784445226952748816445846527769860735 \cdot 10^{-162}:\\
\;\;\;\;\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 6.596793469983033519295935857748423121887 \cdot 10^{-163}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 6.373484080558642358416244903315687209789 \cdot 10^{144}:\\
\;\;\;\;\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 f(double x, double y) {
double r602890 = x;
double r602891 = r602890 * r602890;
double r602892 = y;
double r602893 = 4.0;
double r602894 = r602892 * r602893;
double r602895 = r602894 * r602892;
double r602896 = r602891 - r602895;
double r602897 = r602891 + r602895;
double r602898 = r602896 / r602897;
return r602898;
}
double f(double x, double y) {
double r602899 = x;
double r602900 = -1.3318871728471391e+154;
bool r602901 = r602899 <= r602900;
double r602902 = 1.0;
double r602903 = -1.5707844452269527e-162;
bool r602904 = r602899 <= r602903;
double r602905 = y;
double r602906 = 4.0;
double r602907 = r602905 * r602906;
double r602908 = r602907 * r602905;
double r602909 = fma(r602899, r602899, r602908);
double r602910 = r602909 / r602899;
double r602911 = r602899 / r602910;
double r602912 = 2.0;
double r602913 = pow(r602899, r602912);
double r602914 = r602913 / r602905;
double r602915 = fma(r602906, r602905, r602914);
double r602916 = r602907 / r602915;
double r602917 = r602911 - r602916;
double r602918 = 6.596793469983034e-163;
bool r602919 = r602899 <= r602918;
double r602920 = -1.0;
double r602921 = 6.373484080558642e+144;
bool r602922 = r602899 <= r602921;
double r602923 = r602922 ? r602917 : r602902;
double r602924 = r602919 ? r602920 : r602923;
double r602925 = r602904 ? r602917 : r602924;
double r602926 = r602901 ? r602902 : r602925;
return r602926;
}




Bits error versus x




Bits error versus y
| Original | 31.1 |
|---|---|
| Target | 30.8 |
| Herbie | 3.8 |
if x < -1.3318871728471391e+154 or 6.373484080558642e+144 < x Initial program 62.7
Taylor expanded around inf 8.4
if -1.3318871728471391e+154 < x < -1.5707844452269527e-162 or 6.596793469983034e-163 < x < 6.373484080558642e+144Initial program 15.9
rmApplied div-sub15.9
Simplified16.1
Simplified15.6
Taylor expanded around 0 0.3
Simplified0.3
if -1.5707844452269527e-162 < x < 6.596793469983034e-163Initial program 30.1
Taylor expanded around 0 6.7
Final simplification3.8
herbie shell --seed 2020001 +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))))