\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.517398075841731978978804721327597516736 \cdot 10^{145}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -6.621300319852041212687540142873364646976 \cdot 10^{-102}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, -y \cdot \left(y \cdot 4\right)\right)}{\mathsf{fma}\left(x, x, {y}^{2} \cdot 4\right)}\\
\mathbf{elif}\;x \le 1.295898151448028641074794033905884537542 \cdot 10^{-152}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 6.052303689076668472383783695774322400393 \cdot 10^{95}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, -y \cdot \left(y \cdot 4\right)\right)}{\mathsf{fma}\left(x, x, {y}^{2} \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r883498 = x;
double r883499 = r883498 * r883498;
double r883500 = y;
double r883501 = 4.0;
double r883502 = r883500 * r883501;
double r883503 = r883502 * r883500;
double r883504 = r883499 - r883503;
double r883505 = r883499 + r883503;
double r883506 = r883504 / r883505;
return r883506;
}
double f(double x, double y) {
double r883507 = x;
double r883508 = -1.517398075841732e+145;
bool r883509 = r883507 <= r883508;
double r883510 = 1.0;
double r883511 = -6.621300319852041e-102;
bool r883512 = r883507 <= r883511;
double r883513 = y;
double r883514 = 4.0;
double r883515 = r883513 * r883514;
double r883516 = r883513 * r883515;
double r883517 = -r883516;
double r883518 = fma(r883507, r883507, r883517);
double r883519 = 2.0;
double r883520 = pow(r883513, r883519);
double r883521 = r883520 * r883514;
double r883522 = fma(r883507, r883507, r883521);
double r883523 = r883518 / r883522;
double r883524 = 1.2958981514480286e-152;
bool r883525 = r883507 <= r883524;
double r883526 = -1.0;
double r883527 = 6.052303689076668e+95;
bool r883528 = r883507 <= r883527;
double r883529 = r883528 ? r883523 : r883510;
double r883530 = r883525 ? r883526 : r883529;
double r883531 = r883512 ? r883523 : r883530;
double r883532 = r883509 ? r883510 : r883531;
return r883532;
}




Bits error versus x




Bits error versus y
| Original | 32.2 |
|---|---|
| Target | 31.9 |
| Herbie | 12.6 |
if x < -1.517398075841732e+145 or 6.052303689076668e+95 < x Initial program 55.2
Simplified55.2
rmApplied *-un-lft-identity55.2
Applied *-un-lft-identity55.2
Applied times-frac55.2
Simplified55.2
Simplified55.2
rmApplied add-cbrt-cube63.7
Applied add-cbrt-cube64.0
Applied cbrt-undiv64.0
Simplified55.2
Taylor expanded around inf 10.1
if -1.517398075841732e+145 < x < -6.621300319852041e-102 or 1.2958981514480286e-152 < x < 6.052303689076668e+95Initial program 17.1
Simplified17.1
rmApplied *-un-lft-identity17.1
Applied *-un-lft-identity17.1
Applied times-frac17.1
Simplified17.1
Simplified17.1
if -6.621300319852041e-102 < x < 1.2958981514480286e-152Initial program 28.6
Simplified28.6
Taylor expanded around 0 9.1
Final simplification12.6
herbie shell --seed 2019305 +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.974323384962678118) (- (/ (* 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))))