\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 \cdot x \le 1.04662384361210072 \cdot 10^{-202}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 1.3005275433696336 \cdot 10^{250}:\\
\;\;\;\;\frac{x}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x}} - \frac{y \cdot 4}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{y}}\\
\mathbf{elif}\;x \cdot x \le 2.97717800904674578 \cdot 10^{272}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r679967 = x;
double r679968 = r679967 * r679967;
double r679969 = y;
double r679970 = 4.0;
double r679971 = r679969 * r679970;
double r679972 = r679971 * r679969;
double r679973 = r679968 - r679972;
double r679974 = r679968 + r679972;
double r679975 = r679973 / r679974;
return r679975;
}
double f(double x, double y) {
double r679976 = x;
double r679977 = r679976 * r679976;
double r679978 = 1.0466238436121007e-202;
bool r679979 = r679977 <= r679978;
double r679980 = -1.0;
double r679981 = 1.3005275433696336e+250;
bool r679982 = r679977 <= r679981;
double r679983 = y;
double r679984 = 4.0;
double r679985 = r679983 * r679984;
double r679986 = r679985 * r679983;
double r679987 = fma(r679976, r679976, r679986);
double r679988 = r679987 / r679976;
double r679989 = r679976 / r679988;
double r679990 = r679987 / r679983;
double r679991 = r679985 / r679990;
double r679992 = r679989 - r679991;
double r679993 = 2.977178009046746e+272;
bool r679994 = r679977 <= r679993;
double r679995 = 1.0;
double r679996 = r679994 ? r679980 : r679995;
double r679997 = r679982 ? r679992 : r679996;
double r679998 = r679979 ? r679980 : r679997;
return r679998;
}




Bits error versus x




Bits error versus y
| Original | 31.3 |
|---|---|
| Target | 31.0 |
| Herbie | 12.6 |
if (* x x) < 1.0466238436121007e-202 or 1.3005275433696336e+250 < (* x x) < 2.977178009046746e+272Initial program 25.6
Taylor expanded around 0 12.7
if 1.0466238436121007e-202 < (* x x) < 1.3005275433696336e+250Initial program 15.7
rmApplied div-sub15.7
Simplified15.7
Simplified15.2
if 2.977178009046746e+272 < (* x x) Initial program 59.2
Taylor expanded around inf 8.9
Final simplification12.6
herbie shell --seed 2020064 +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))))