\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 -6.06717838938592463 \cdot 10^{31}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le 5.2797885245263103 \cdot 10^{-80}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 5.32364720038125515 \cdot 10^{39}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x \cdot x - \left(y \cdot 4\right) \cdot y}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r645856 = x;
double r645857 = r645856 * r645856;
double r645858 = y;
double r645859 = 4.0;
double r645860 = r645858 * r645859;
double r645861 = r645860 * r645858;
double r645862 = r645857 - r645861;
double r645863 = r645857 + r645861;
double r645864 = r645862 / r645863;
return r645864;
}
double f(double x, double y) {
double r645865 = x;
double r645866 = -6.067178389385925e+31;
bool r645867 = r645865 <= r645866;
double r645868 = 1.0;
double r645869 = 5.27978852452631e-80;
bool r645870 = r645865 <= r645869;
double r645871 = -1.0;
double r645872 = 5.323647200381255e+39;
bool r645873 = r645865 <= r645872;
double r645874 = y;
double r645875 = 4.0;
double r645876 = r645874 * r645875;
double r645877 = r645876 * r645874;
double r645878 = fma(r645865, r645865, r645877);
double r645879 = r645865 * r645865;
double r645880 = r645879 - r645877;
double r645881 = r645878 / r645880;
double r645882 = r645868 / r645881;
double r645883 = r645873 ? r645882 : r645868;
double r645884 = r645870 ? r645871 : r645883;
double r645885 = r645867 ? r645868 : r645884;
return r645885;
}




Bits error versus x




Bits error versus y
| Original | 31.7 |
|---|---|
| Target | 31.4 |
| Herbie | 14.8 |
if x < -6.067178389385925e+31 or 5.323647200381255e+39 < x Initial program 43.1
Taylor expanded around inf 14.1
if -6.067178389385925e+31 < x < 5.27978852452631e-80Initial program 24.4
Taylor expanded around 0 15.3
if 5.27978852452631e-80 < x < 5.323647200381255e+39Initial program 15.6
rmApplied clear-num15.6
Simplified15.6
Final simplification14.8
herbie shell --seed 2020057 +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))))