\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}\;y \le -7.32107702472276128411193082390112739547 \cdot 10^{-18}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 1.577263682377974965666846612933656955984 \cdot 10^{51}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r680699 = x;
double r680700 = r680699 * r680699;
double r680701 = y;
double r680702 = 4.0;
double r680703 = r680701 * r680702;
double r680704 = r680703 * r680701;
double r680705 = r680700 - r680704;
double r680706 = r680700 + r680704;
double r680707 = r680705 / r680706;
return r680707;
}
double f(double __attribute__((unused)) x, double y) {
double r680708 = y;
double r680709 = -7.321077024722761e-18;
bool r680710 = r680708 <= r680709;
double r680711 = -1.0;
double r680712 = 1.577263682377975e+51;
bool r680713 = r680708 <= r680712;
double r680714 = 1.0;
double r680715 = r680713 ? r680714 : r680711;
double r680716 = r680710 ? r680711 : r680715;
return r680716;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 31.4 |
| Herbie | 15.7 |
if y < -7.321077024722761e-18 or 1.577263682377975e+51 < y Initial program 41.5
Taylor expanded around 0 15.1
if -7.321077024722761e-18 < y < 1.577263682377975e+51Initial program 22.9
Taylor expanded around inf 16.2
Final simplification15.7
herbie shell --seed 2019353 +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))))