\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 -2590647937.20362567901611328125:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le 1190.57638633722717713681049644947052002:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r487981 = x;
double r487982 = r487981 * r487981;
double r487983 = y;
double r487984 = 4.0;
double r487985 = r487983 * r487984;
double r487986 = r487985 * r487983;
double r487987 = r487982 - r487986;
double r487988 = r487982 + r487986;
double r487989 = r487987 / r487988;
return r487989;
}
double f(double __attribute__((unused)) x, double y) {
double r487990 = y;
double r487991 = -2590647937.2036257;
bool r487992 = r487990 <= r487991;
double r487993 = -1.0;
double r487994 = 1190.5763863372272;
bool r487995 = r487990 <= r487994;
double r487996 = 1.0;
double r487997 = r487995 ? r487996 : r487993;
double r487998 = r487992 ? r487993 : r487997;
return r487998;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.2 |
|---|---|
| Target | 30.9 |
| Herbie | 16.0 |
if y < -2590647937.2036257 or 1190.5763863372272 < y Initial program 40.2
Taylor expanded around 0 15.5
if -2590647937.2036257 < y < 1190.5763863372272Initial program 22.4
Taylor expanded around inf 16.6
Final simplification16.0
herbie shell --seed 2019209
(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.974323384962678118) (- (/ (* 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))))