\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 r604447 = x;
double r604448 = r604447 * r604447;
double r604449 = y;
double r604450 = 4.0;
double r604451 = r604449 * r604450;
double r604452 = r604451 * r604449;
double r604453 = r604448 - r604452;
double r604454 = r604448 + r604452;
double r604455 = r604453 / r604454;
return r604455;
}
double f(double x, double y) {
double r604456 = x;
double r604457 = -1.3318871728471391e+154;
bool r604458 = r604456 <= r604457;
double r604459 = 1.0;
double r604460 = -1.5707844452269527e-162;
bool r604461 = r604456 <= r604460;
double r604462 = y;
double r604463 = 4.0;
double r604464 = r604462 * r604463;
double r604465 = r604464 * r604462;
double r604466 = fma(r604456, r604456, r604465);
double r604467 = r604466 / r604456;
double r604468 = r604456 / r604467;
double r604469 = 2.0;
double r604470 = pow(r604456, r604469);
double r604471 = r604470 / r604462;
double r604472 = fma(r604463, r604462, r604471);
double r604473 = r604464 / r604472;
double r604474 = r604468 - r604473;
double r604475 = 6.596793469983034e-163;
bool r604476 = r604456 <= r604475;
double r604477 = -1.0;
double r604478 = 6.373484080558642e+144;
bool r604479 = r604456 <= r604478;
double r604480 = r604479 ? r604474 : r604459;
double r604481 = r604476 ? r604477 : r604480;
double r604482 = r604461 ? r604474 : r604481;
double r604483 = r604458 ? r604459 : r604482;
return r604483;
}




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))))