\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 -4.542162861981963339451786530680392909626 \cdot 10^{56}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -5.780522729495912693679807571274083237549 \cdot 10^{-162}:\\
\;\;\;\;\left(\sqrt[3]{\frac{x \cdot x - \left(4 \cdot y\right) \cdot y}{\left(4 \cdot y\right) \cdot y + x \cdot x}} \cdot \sqrt[3]{\frac{x \cdot x - \left(4 \cdot y\right) \cdot y}{\left(4 \cdot y\right) \cdot y + x \cdot x}}\right) \cdot \sqrt[3]{\frac{x \cdot x - \left(4 \cdot y\right) \cdot y}{\left(4 \cdot y\right) \cdot y + x \cdot x}}\\
\mathbf{elif}\;x \le 5.430501749338192800539606964665669060352 \cdot 10^{-128}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 6.680131771318429129718732452803437555736 \cdot 10^{54}:\\
\;\;\;\;\left(\sqrt[3]{\frac{x \cdot x - \left(4 \cdot y\right) \cdot y}{\left(4 \cdot y\right) \cdot y + x \cdot x}} \cdot \sqrt[3]{\frac{x \cdot x - \left(4 \cdot y\right) \cdot y}{\left(4 \cdot y\right) \cdot y + x \cdot x}}\right) \cdot \sqrt[3]{\frac{x \cdot x - \left(4 \cdot y\right) \cdot y}{\left(4 \cdot y\right) \cdot y + x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r392169 = x;
double r392170 = r392169 * r392169;
double r392171 = y;
double r392172 = 4.0;
double r392173 = r392171 * r392172;
double r392174 = r392173 * r392171;
double r392175 = r392170 - r392174;
double r392176 = r392170 + r392174;
double r392177 = r392175 / r392176;
return r392177;
}
double f(double x, double y) {
double r392178 = x;
double r392179 = -4.542162861981963e+56;
bool r392180 = r392178 <= r392179;
double r392181 = 1.0;
double r392182 = -5.780522729495913e-162;
bool r392183 = r392178 <= r392182;
double r392184 = r392178 * r392178;
double r392185 = 4.0;
double r392186 = y;
double r392187 = r392185 * r392186;
double r392188 = r392187 * r392186;
double r392189 = r392184 - r392188;
double r392190 = r392188 + r392184;
double r392191 = r392189 / r392190;
double r392192 = cbrt(r392191);
double r392193 = r392192 * r392192;
double r392194 = r392193 * r392192;
double r392195 = 5.430501749338193e-128;
bool r392196 = r392178 <= r392195;
double r392197 = -1.0;
double r392198 = 6.680131771318429e+54;
bool r392199 = r392178 <= r392198;
double r392200 = r392199 ? r392194 : r392181;
double r392201 = r392196 ? r392197 : r392200;
double r392202 = r392183 ? r392194 : r392201;
double r392203 = r392180 ? r392181 : r392202;
return r392203;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.5 |
|---|---|
| Target | 31.2 |
| Herbie | 13.2 |
if x < -4.542162861981963e+56 or 6.680131771318429e+54 < x Initial program 45.6
Simplified45.6
Taylor expanded around inf 13.9
if -4.542162861981963e+56 < x < -5.780522729495913e-162 or 5.430501749338193e-128 < x < 6.680131771318429e+54Initial program 15.6
Simplified15.6
rmApplied add-cube-cbrt15.6
Simplified15.6
Simplified15.6
if -5.780522729495913e-162 < x < 5.430501749338193e-128Initial program 29.3
Simplified29.3
Taylor expanded around 0 9.3
Final simplification13.2
herbie shell --seed 2019196
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
: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))))