\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 \cdot x \le 0.0:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 1.5398622348223129 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}\right)\right)\\
\mathbf{elif}\;x \cdot x \le 141747905838.435699:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 4.0633860768193028 \cdot 10^{300}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r634785 = x;
double r634786 = r634785 * r634785;
double r634787 = y;
double r634788 = 4.0;
double r634789 = r634787 * r634788;
double r634790 = r634789 * r634787;
double r634791 = r634786 - r634790;
double r634792 = r634786 + r634790;
double r634793 = r634791 / r634792;
return r634793;
}
double f(double x, double y) {
double r634794 = x;
double r634795 = r634794 * r634794;
double r634796 = 0.0;
bool r634797 = r634795 <= r634796;
double r634798 = -1.0;
double r634799 = 1.539862234822313e-35;
bool r634800 = r634795 <= r634799;
double r634801 = y;
double r634802 = 4.0;
double r634803 = r634801 * r634802;
double r634804 = r634803 * r634801;
double r634805 = r634795 - r634804;
double r634806 = r634795 + r634804;
double r634807 = r634805 / r634806;
double r634808 = expm1(r634807);
double r634809 = log1p(r634808);
double r634810 = 141747905838.4357;
bool r634811 = r634795 <= r634810;
double r634812 = 4.063386076819303e+300;
bool r634813 = r634795 <= r634812;
double r634814 = fma(r634794, r634794, r634804);
double r634815 = r634814 / r634794;
double r634816 = r634794 / r634815;
double r634817 = r634814 / r634801;
double r634818 = r634803 / r634817;
double r634819 = r634816 - r634818;
double r634820 = 1.0;
double r634821 = r634813 ? r634819 : r634820;
double r634822 = r634811 ? r634798 : r634821;
double r634823 = r634800 ? r634809 : r634822;
double r634824 = r634797 ? r634798 : r634823;
return r634824;
}




Bits error versus x




Bits error versus y
| Original | 32.1 |
|---|---|
| Target | 31.8 |
| Herbie | 13.0 |
if (* x x) < 0.0 or 1.539862234822313e-35 < (* x x) < 141747905838.4357Initial program 30.3
Taylor expanded around 0 10.8
if 0.0 < (* x x) < 1.539862234822313e-35Initial program 16.2
rmApplied log1p-expm1-u16.2
if 141747905838.4357 < (* x x) < 4.063386076819303e+300Initial program 17.5
rmApplied div-sub17.5
Simplified17.6
Simplified17.0
if 4.063386076819303e+300 < (* x x) Initial program 63.0
Taylor expanded around inf 8.6
Final simplification13.0
herbie shell --seed 2020089 +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))))