\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 r368402 = x;
double r368403 = r368402 * r368402;
double r368404 = y;
double r368405 = 4.0;
double r368406 = r368404 * r368405;
double r368407 = r368406 * r368404;
double r368408 = r368403 - r368407;
double r368409 = r368403 + r368407;
double r368410 = r368408 / r368409;
return r368410;
}
double f(double x, double y) {
double r368411 = y;
double r368412 = 4.0;
double r368413 = r368411 * r368412;
double r368414 = r368413 * r368411;
double r368415 = 3.4146233179475937e-192;
bool r368416 = r368414 <= r368415;
double r368417 = 1.0;
double r368418 = 3.8100036437198633e+67;
bool r368419 = r368414 <= r368418;
double r368420 = x;
double r368421 = r368420 * r368420;
double r368422 = fma(r368420, r368420, r368414);
double r368423 = r368421 / r368422;
double r368424 = r368414 / r368422;
double r368425 = r368423 - r368424;
double r368426 = 1.7563388863584677e+115;
bool r368427 = r368414 <= r368426;
double r368428 = 9.415768721852471e+215;
bool r368429 = r368414 <= r368428;
double r368430 = -1.0;
double r368431 = r368429 ? r368425 : r368430;
double r368432 = r368427 ? r368417 : r368431;
double r368433 = r368419 ? r368425 : r368432;
double r368434 = r368416 ? r368417 : r368433;
return r368434;
}




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))))