\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.35942609678321041 \cdot 10^{154}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -4.1599445058185013 \cdot 10^{-139}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y \cdot 4}{\mathsf{fma}\left(4, y, \frac{{x}^{2}}{y}\right)}\right)\right)\\
\mathbf{elif}\;x \le 4.2299291990473933 \cdot 10^{-187}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 1.18794817367348284 \cdot 10^{141}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y \cdot 4}{\mathsf{fma}\left(4, y, \frac{{x}^{2}}{y}\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r912456 = x;
double r912457 = r912456 * r912456;
double r912458 = y;
double r912459 = 4.0;
double r912460 = r912458 * r912459;
double r912461 = r912460 * r912458;
double r912462 = r912457 - r912461;
double r912463 = r912457 + r912461;
double r912464 = r912462 / r912463;
return r912464;
}
double f(double x, double y) {
double r912465 = x;
double r912466 = -1.3594260967832104e+154;
bool r912467 = r912465 <= r912466;
double r912468 = 1.0;
double r912469 = -4.159944505818501e-139;
bool r912470 = r912465 <= r912469;
double r912471 = y;
double r912472 = 4.0;
double r912473 = r912471 * r912472;
double r912474 = r912473 * r912471;
double r912475 = fma(r912465, r912465, r912474);
double r912476 = r912475 / r912465;
double r912477 = r912465 / r912476;
double r912478 = 2.0;
double r912479 = pow(r912465, r912478);
double r912480 = r912479 / r912471;
double r912481 = fma(r912472, r912471, r912480);
double r912482 = r912473 / r912481;
double r912483 = log1p(r912482);
double r912484 = expm1(r912483);
double r912485 = r912477 - r912484;
double r912486 = 4.2299291990473933e-187;
bool r912487 = r912465 <= r912486;
double r912488 = -1.0;
double r912489 = 1.1879481736734828e+141;
bool r912490 = r912465 <= r912489;
double r912491 = r912490 ? r912485 : r912468;
double r912492 = r912487 ? r912488 : r912491;
double r912493 = r912470 ? r912485 : r912492;
double r912494 = r912467 ? r912468 : r912493;
return r912494;
}




Bits error versus x




Bits error versus y
| Original | 31.9 |
|---|---|
| Target | 31.6 |
| Herbie | 4.6 |
if x < -1.3594260967832104e+154 or 1.1879481736734828e+141 < x Initial program 62.1
Taylor expanded around inf 9.4
if -1.3594260967832104e+154 < x < -4.159944505818501e-139 or 4.2299291990473933e-187 < x < 1.1879481736734828e+141Initial program 17.1
rmApplied div-sub17.1
Simplified17.2
Simplified16.7
Taylor expanded around 0 0.8
Simplified0.8
rmApplied expm1-log1p-u0.8
if -4.159944505818501e-139 < x < 4.2299291990473933e-187Initial program 29.7
Taylor expanded around 0 7.4
Final simplification4.6
herbie shell --seed 2020025 +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))))