\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.287656836218587817843721098850935729447 \cdot 10^{137}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -1.530862185462861244589348861406538600327 \cdot 10^{-62}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\\
\mathbf{elif}\;x \le 1.637752758454048808996152623221730747955 \cdot 10^{-55}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 3.168622066814080755323424526904394535226 \cdot 10^{74}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r490450 = x;
double r490451 = r490450 * r490450;
double r490452 = y;
double r490453 = 4.0;
double r490454 = r490452 * r490453;
double r490455 = r490454 * r490452;
double r490456 = r490451 - r490455;
double r490457 = r490451 + r490455;
double r490458 = r490456 / r490457;
return r490458;
}
double f(double x, double y) {
double r490459 = x;
double r490460 = -1.2876568362185878e+137;
bool r490461 = r490459 <= r490460;
double r490462 = 1.0;
double r490463 = -1.5308621854628612e-62;
bool r490464 = r490459 <= r490463;
double r490465 = r490459 * r490459;
double r490466 = y;
double r490467 = 4.0;
double r490468 = r490466 * r490467;
double r490469 = r490468 * r490466;
double r490470 = fma(r490459, r490459, r490469);
double r490471 = r490465 / r490470;
double r490472 = r490469 / r490470;
double r490473 = r490471 - r490472;
double r490474 = 1.6377527584540488e-55;
bool r490475 = r490459 <= r490474;
double r490476 = -1.0;
double r490477 = 3.168622066814081e+74;
bool r490478 = r490459 <= r490477;
double r490479 = r490478 ? r490473 : r490462;
double r490480 = r490475 ? r490476 : r490479;
double r490481 = r490464 ? r490473 : r490480;
double r490482 = r490461 ? r490462 : r490481;
return r490482;
}




Bits error versus x




Bits error versus y
| Original | 31.9 |
|---|---|
| Target | 31.6 |
| Herbie | 12.9 |
if x < -1.2876568362185878e+137 or 3.168622066814081e+74 < x Initial program 52.3
Taylor expanded around inf 10.7
if -1.2876568362185878e+137 < x < -1.5308621854628612e-62 or 1.6377527584540488e-55 < x < 3.168622066814081e+74Initial program 15.7
rmApplied div-sub15.6
Simplified15.6
Simplified15.6
if -1.5308621854628612e-62 < x < 1.6377527584540488e-55Initial program 25.5
Taylor expanded around 0 13.0
Final simplification12.9
herbie shell --seed 2019304 +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))))