\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 r2707 = x;
double r2708 = r2707 * r2707;
double r2709 = y;
double r2710 = 4.0;
double r2711 = r2709 * r2710;
double r2712 = r2711 * r2709;
double r2713 = r2708 - r2712;
double r2714 = r2708 + r2712;
double r2715 = r2713 / r2714;
return r2715;
}
double f(double x, double y) {
double r2716 = x;
double r2717 = -1.3594260967832104e+154;
bool r2718 = r2716 <= r2717;
double r2719 = 1.0;
double r2720 = -4.159944505818501e-139;
bool r2721 = r2716 <= r2720;
double r2722 = y;
double r2723 = 4.0;
double r2724 = r2722 * r2723;
double r2725 = r2724 * r2722;
double r2726 = fma(r2716, r2716, r2725);
double r2727 = r2726 / r2716;
double r2728 = r2716 / r2727;
double r2729 = 2.0;
double r2730 = pow(r2716, r2729);
double r2731 = r2730 / r2722;
double r2732 = fma(r2723, r2722, r2731);
double r2733 = r2724 / r2732;
double r2734 = log1p(r2733);
double r2735 = expm1(r2734);
double r2736 = r2728 - r2735;
double r2737 = 4.2299291990473933e-187;
bool r2738 = r2716 <= r2737;
double r2739 = -1.0;
double r2740 = 1.1879481736734828e+141;
bool r2741 = r2716 <= r2740;
double r2742 = r2741 ? r2736 : r2719;
double r2743 = r2738 ? r2739 : r2742;
double r2744 = r2721 ? r2736 : r2743;
double r2745 = r2718 ? r2719 : r2744;
return r2745;
}




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