\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}\;y \le -4.758167358261969805068202523877348166337 \cdot 10^{148}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.63689029313189507811324572738338926855 \cdot 10^{-160}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, -\left(y \cdot 4\right) \cdot y\right)}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\\
\mathbf{elif}\;y \le 1.575397687437991456648509198388754062127 \cdot 10^{-55}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 8.134021215145637850375061461407044861883 \cdot 10^{-38}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\right)\right)\\
\mathbf{elif}\;y \le 98355.24381927796639502048492431640625:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r499571 = x;
double r499572 = r499571 * r499571;
double r499573 = y;
double r499574 = 4.0;
double r499575 = r499573 * r499574;
double r499576 = r499575 * r499573;
double r499577 = r499572 - r499576;
double r499578 = r499572 + r499576;
double r499579 = r499577 / r499578;
return r499579;
}
double f(double x, double y) {
double r499580 = y;
double r499581 = -4.75816735826197e+148;
bool r499582 = r499580 <= r499581;
double r499583 = -1.0;
double r499584 = -1.636890293131895e-160;
bool r499585 = r499580 <= r499584;
double r499586 = x;
double r499587 = 4.0;
double r499588 = r499580 * r499587;
double r499589 = r499588 * r499580;
double r499590 = -r499589;
double r499591 = fma(r499586, r499586, r499590);
double r499592 = fma(r499586, r499586, r499589);
double r499593 = r499591 / r499592;
double r499594 = 1.5753976874379915e-55;
bool r499595 = r499580 <= r499594;
double r499596 = 1.0;
double r499597 = 8.134021215145638e-38;
bool r499598 = r499580 <= r499597;
double r499599 = r499586 * r499586;
double r499600 = r499599 - r499589;
double r499601 = r499600 / r499592;
double r499602 = expm1(r499601);
double r499603 = log1p(r499602);
double r499604 = 98355.24381927797;
bool r499605 = r499580 <= r499604;
double r499606 = r499605 ? r499596 : r499583;
double r499607 = r499598 ? r499603 : r499606;
double r499608 = r499595 ? r499596 : r499607;
double r499609 = r499585 ? r499593 : r499608;
double r499610 = r499582 ? r499583 : r499609;
return r499610;
}




Bits error versus x




Bits error versus y
| Original | 31.2 |
|---|---|
| Target | 30.9 |
| Herbie | 13.9 |
if y < -4.75816735826197e+148 or 98355.24381927797 < y Initial program 47.9
Simplified47.9
rmApplied log1p-expm1-u47.9
Taylor expanded around 0 13.3
if -4.75816735826197e+148 < y < -1.636890293131895e-160Initial program 16.0
Simplified16.0
rmApplied fma-neg16.0
if -1.636890293131895e-160 < y < 1.5753976874379915e-55 or 8.134021215145638e-38 < y < 98355.24381927797Initial program 24.9
Simplified24.9
Taylor expanded around inf 12.6
if 1.5753976874379915e-55 < y < 8.134021215145638e-38Initial program 20.1
Simplified20.1
rmApplied log1p-expm1-u20.1
Final simplification13.9
herbie shell --seed 2019303 +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))))