\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 0.0:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 8.14624205965243804 \cdot 10^{-197}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{1}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{\left(y \cdot 4\right) \cdot y}}\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 1.89336738182365018 \cdot 10^{-164}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 2.080267309844611 \cdot 10^{-17}:\\
\;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)} - \frac{1}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{\left(y \cdot 4\right) \cdot y}}\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 5.0547066207328322 \cdot 10^{101}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 2.6000500965086023 \cdot 10^{199}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r484778 = x;
double r484779 = r484778 * r484778;
double r484780 = y;
double r484781 = 4.0;
double r484782 = r484780 * r484781;
double r484783 = r484782 * r484780;
double r484784 = r484779 - r484783;
double r484785 = r484779 + r484783;
double r484786 = r484784 / r484785;
return r484786;
}
double f(double x, double y) {
double r484787 = y;
double r484788 = 4.0;
double r484789 = r484787 * r484788;
double r484790 = r484789 * r484787;
double r484791 = 0.0;
bool r484792 = r484790 <= r484791;
double r484793 = 1.0;
double r484794 = 8.146242059652438e-197;
bool r484795 = r484790 <= r484794;
double r484796 = x;
double r484797 = r484796 * r484796;
double r484798 = fma(r484796, r484796, r484790);
double r484799 = r484797 / r484798;
double r484800 = r484798 / r484790;
double r484801 = r484793 / r484800;
double r484802 = r484799 - r484801;
double r484803 = 1.89336738182365e-164;
bool r484804 = r484790 <= r484803;
double r484805 = 2.080267309844611e-17;
bool r484806 = r484790 <= r484805;
double r484807 = 5.054706620732832e+101;
bool r484808 = r484790 <= r484807;
double r484809 = 2.6000500965086023e+199;
bool r484810 = r484790 <= r484809;
double r484811 = r484790 / r484798;
double r484812 = r484799 - r484811;
double r484813 = 1.0;
double r484814 = -r484813;
double r484815 = r484810 ? r484812 : r484814;
double r484816 = r484808 ? r484793 : r484815;
double r484817 = r484806 ? r484802 : r484816;
double r484818 = r484804 ? r484793 : r484817;
double r484819 = r484795 ? r484802 : r484818;
double r484820 = r484792 ? r484793 : r484819;
return r484820;
}




Bits error versus x




Bits error versus y
| Original | 31.3 |
|---|---|
| Target | 31.1 |
| Herbie | 14.7 |
if (* (* y 4.0) y) < 0.0 or 8.146242059652438e-197 < (* (* y 4.0) y) < 1.89336738182365e-164 or 2.080267309844611e-17 < (* (* y 4.0) y) < 5.054706620732832e+101Initial program 25.7
Taylor expanded around inf 16.9
if 0.0 < (* (* y 4.0) y) < 8.146242059652438e-197 or 1.89336738182365e-164 < (* (* y 4.0) y) < 2.080267309844611e-17Initial program 16.5
rmApplied div-sub16.5
Simplified16.5
Simplified16.5
rmApplied clear-num16.5
if 5.054706620732832e+101 < (* (* y 4.0) y) < 2.6000500965086023e+199Initial program 15.1
rmApplied div-sub15.1
Simplified15.1
Simplified15.1
if 2.6000500965086023e+199 < (* (* y 4.0) y) Initial program 50.7
rmApplied div-sub50.7
Simplified50.7
Simplified50.7
rmApplied clear-num50.7
Taylor expanded around 0 11.1
Final simplification14.7
herbie shell --seed 2019198 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:herbie-target
(if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))