\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 r683585 = x;
double r683586 = r683585 * r683585;
double r683587 = y;
double r683588 = 4.0;
double r683589 = r683587 * r683588;
double r683590 = r683589 * r683587;
double r683591 = r683586 - r683590;
double r683592 = r683586 + r683590;
double r683593 = r683591 / r683592;
return r683593;
}
double f(double x, double y) {
double r683594 = x;
double r683595 = -1.3318871728471391e+154;
bool r683596 = r683594 <= r683595;
double r683597 = 1.0;
double r683598 = -1.5707844452269527e-162;
bool r683599 = r683594 <= r683598;
double r683600 = y;
double r683601 = 4.0;
double r683602 = r683600 * r683601;
double r683603 = r683602 * r683600;
double r683604 = fma(r683594, r683594, r683603);
double r683605 = r683604 / r683594;
double r683606 = r683594 / r683605;
double r683607 = 2.0;
double r683608 = pow(r683594, r683607);
double r683609 = r683608 / r683600;
double r683610 = fma(r683601, r683600, r683609);
double r683611 = r683602 / r683610;
double r683612 = r683606 - r683611;
double r683613 = 6.596793469983034e-163;
bool r683614 = r683594 <= r683613;
double r683615 = -1.0;
double r683616 = 6.373484080558642e+144;
bool r683617 = r683594 <= r683616;
double r683618 = r683617 ? r683612 : r683597;
double r683619 = r683614 ? r683615 : r683618;
double r683620 = r683599 ? r683612 : r683619;
double r683621 = r683596 ? r683597 : r683620;
return r683621;
}




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