\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 3.414623317947593663745953537661023590748 \cdot 10^{-192}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 3.810003643719863336668138253262668476651 \cdot 10^{67}:\\
\;\;\;\;\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{elif}\;\left(y \cdot 4\right) \cdot y \le 1.756338886358467686795570653182400240677 \cdot 10^{115}:\\
\;\;\;\;1\\
\mathbf{elif}\;\left(y \cdot 4\right) \cdot y \le 9.415768721852470917873482124314739876564 \cdot 10^{215}:\\
\;\;\;\;\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 r520075 = x;
double r520076 = r520075 * r520075;
double r520077 = y;
double r520078 = 4.0;
double r520079 = r520077 * r520078;
double r520080 = r520079 * r520077;
double r520081 = r520076 - r520080;
double r520082 = r520076 + r520080;
double r520083 = r520081 / r520082;
return r520083;
}
double f(double x, double y) {
double r520084 = y;
double r520085 = 4.0;
double r520086 = r520084 * r520085;
double r520087 = r520086 * r520084;
double r520088 = 3.4146233179475937e-192;
bool r520089 = r520087 <= r520088;
double r520090 = 1.0;
double r520091 = 3.8100036437198633e+67;
bool r520092 = r520087 <= r520091;
double r520093 = x;
double r520094 = r520093 * r520093;
double r520095 = fma(r520093, r520093, r520087);
double r520096 = r520094 / r520095;
double r520097 = r520087 / r520095;
double r520098 = r520096 - r520097;
double r520099 = 1.7563388863584677e+115;
bool r520100 = r520087 <= r520099;
double r520101 = 9.415768721852471e+215;
bool r520102 = r520087 <= r520101;
double r520103 = -1.0;
double r520104 = r520102 ? r520098 : r520103;
double r520105 = r520100 ? r520090 : r520104;
double r520106 = r520092 ? r520098 : r520105;
double r520107 = r520089 ? r520090 : r520106;
return r520107;
}




Bits error versus x




Bits error versus y
| Original | 31.5 |
|---|---|
| Target | 31.2 |
| Herbie | 12.7 |
if (* (* y 4.0) y) < 3.4146233179475937e-192 or 3.8100036437198633e+67 < (* (* y 4.0) y) < 1.7563388863584677e+115Initial program 26.4
Taylor expanded around inf 13.0
if 3.4146233179475937e-192 < (* (* y 4.0) y) < 3.8100036437198633e+67 or 1.7563388863584677e+115 < (* (* y 4.0) y) < 9.415768721852471e+215Initial program 15.0
rmApplied div-sub15.0
Simplified15.0
Simplified15.0
if 9.415768721852471e+215 < (* (* y 4.0) y) Initial program 52.5
Taylor expanded around 0 10.3
Final simplification12.7
herbie shell --seed 2019326 +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))))