\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.6533496348093263 \cdot 10^{136}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -8.5079988842821871 \cdot 10^{-92}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{y}}\\
\mathbf{elif}\;x \le 5.33120441752882848 \cdot 10^{-100}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 1.6140055087642122 \cdot 10^{150}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r637712 = x;
double r637713 = r637712 * r637712;
double r637714 = y;
double r637715 = 4.0;
double r637716 = r637714 * r637715;
double r637717 = r637716 * r637714;
double r637718 = r637713 - r637717;
double r637719 = r637713 + r637717;
double r637720 = r637718 / r637719;
return r637720;
}
double f(double x, double y) {
double r637721 = x;
double r637722 = -1.6533496348093263e+136;
bool r637723 = r637721 <= r637722;
double r637724 = 1.0;
double r637725 = -8.507998884282187e-92;
bool r637726 = r637721 <= r637725;
double r637727 = y;
double r637728 = 4.0;
double r637729 = r637727 * r637728;
double r637730 = r637729 * r637727;
double r637731 = fma(r637721, r637721, r637730);
double r637732 = r637731 / r637721;
double r637733 = r637721 / r637732;
double r637734 = r637731 / r637727;
double r637735 = r637729 / r637734;
double r637736 = r637733 - r637735;
double r637737 = 5.331204417528828e-100;
bool r637738 = r637721 <= r637737;
double r637739 = -1.0;
double r637740 = 1.6140055087642122e+150;
bool r637741 = r637721 <= r637740;
double r637742 = r637741 ? r637736 : r637724;
double r637743 = r637738 ? r637739 : r637742;
double r637744 = r637726 ? r637736 : r637743;
double r637745 = r637723 ? r637724 : r637744;
return r637745;
}




Bits error versus x




Bits error versus y
| Original | 31.3 |
|---|---|
| Target | 31.0 |
| Herbie | 12.3 |
if x < -1.6533496348093263e+136 or 1.6140055087642122e+150 < x Initial program 60.3
Taylor expanded around inf 8.8
if -1.6533496348093263e+136 < x < -8.507998884282187e-92 or 5.331204417528828e-100 < x < 1.6140055087642122e+150Initial program 15.6
rmApplied div-sub15.5
Simplified15.6
Simplified15.1
if -8.507998884282187e-92 < x < 5.331204417528828e-100Initial program 27.1
Taylor expanded around 0 11.6
Final simplification12.3
herbie shell --seed 2020100 +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))))