\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}\;\left(y \cdot 4\right) \cdot y \le 1.883987095627688634773256576903935146579 \cdot 10^{-179}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 25951328951665387827625984:\\
\;\;\;\;\left(\sqrt[3]{\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \cdot \sqrt[3]{\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\right) \cdot \sqrt[3]{\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 56309717854388472133950898176:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 7.251271519567312889559392701775878259286 \cdot 10^{285}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \sqrt[3]{{\left(\frac{\left(y \cdot 4\right) \cdot y}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}\right)}^{3}}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r566963 = x;
double r566964 = r566963 * r566963;
double r566965 = y;
double r566966 = 4.0;
double r566967 = r566965 * r566966;
double r566968 = r566967 * r566965;
double r566969 = r566964 - r566968;
double r566970 = r566964 + r566968;
double r566971 = r566969 / r566970;
return r566971;
}
double f(double x, double y) {
double r566972 = y;
double r566973 = 4.0;
double r566974 = r566972 * r566973;
double r566975 = r566974 * r566972;
double r566976 = 1.8839870956276886e-179;
bool r566977 = r566975 <= r566976;
double r566978 = 1.0;
double r566979 = 2.5951328951665388e+25;
bool r566980 = r566975 <= r566979;
double r566981 = x;
double r566982 = r566981 * r566981;
double r566983 = fma(r566981, r566981, r566975);
double r566984 = r566982 / r566983;
double r566985 = r566975 / r566983;
double r566986 = r566984 - r566985;
double r566987 = cbrt(r566986);
double r566988 = r566987 * r566987;
double r566989 = r566988 * r566987;
double r566990 = 5.630971785438847e+28;
bool r566991 = r566975 <= r566990;
double r566992 = 7.251271519567313e+285;
bool r566993 = r566975 <= r566992;
double r566994 = 3.0;
double r566995 = pow(r566985, r566994);
double r566996 = cbrt(r566995);
double r566997 = r566984 - r566996;
double r566998 = -1.0;
double r566999 = r566993 ? r566997 : r566998;
double r567000 = r566991 ? r566978 : r566999;
double r567001 = r566980 ? r566989 : r567000;
double r567002 = r566977 ? r566978 : r567001;
return r567002;
}




Bits error versus x




Bits error versus y
| Original | 31.7 |
|---|---|
| Target | 31.4 |
| Herbie | 12.4 |
if (* (* y 4.0) y) < 1.8839870956276886e-179 or 2.5951328951665388e+25 < (* (* y 4.0) y) < 5.630971785438847e+28Initial program 26.3
Simplified26.3
Taylor expanded around inf 11.7
if 1.8839870956276886e-179 < (* (* y 4.0) y) < 2.5951328951665388e+25Initial program 16.4
Simplified16.4
rmApplied div-sub16.4
rmApplied add-cube-cbrt16.4
if 5.630971785438847e+28 < (* (* y 4.0) y) < 7.251271519567313e+285Initial program 15.2
Simplified15.2
rmApplied div-sub15.2
rmApplied add-cbrt-cube44.2
Applied add-cbrt-cube45.8
Applied add-cbrt-cube45.8
Applied add-cbrt-cube45.8
Applied cbrt-unprod45.9
Applied cbrt-unprod49.3
Applied cbrt-undiv49.3
Simplified15.2
if 7.251271519567313e+285 < (* (* y 4.0) y) Initial program 61.2
Simplified61.2
Taylor expanded around 0 8.9
Final simplification12.4
herbie shell --seed 2019323 +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))))