\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.1009678461595335 \cdot 10^{-279}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 2.3515556900183252 \cdot 10^{-150}:\\
\;\;\;\;\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 5.9556908252936597 \cdot 10^{-131}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \le 7.1565475002938845 \cdot 10^{289}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r533397 = x;
double r533398 = r533397 * r533397;
double r533399 = y;
double r533400 = 4.0;
double r533401 = r533399 * r533400;
double r533402 = r533401 * r533399;
double r533403 = r533398 - r533402;
double r533404 = r533398 + r533402;
double r533405 = r533403 / r533404;
return r533405;
}
double f(double x, double y) {
double r533406 = x;
double r533407 = r533406 * r533406;
double r533408 = 1.1009678461595335e-279;
bool r533409 = r533407 <= r533408;
double r533410 = -1.0;
double r533411 = 2.3515556900183252e-150;
bool r533412 = r533407 <= r533411;
double r533413 = y;
double r533414 = 4.0;
double r533415 = r533413 * r533414;
double r533416 = r533415 * r533413;
double r533417 = fma(r533406, r533406, r533416);
double r533418 = r533417 / r533406;
double r533419 = r533406 / r533418;
double r533420 = r533417 / r533413;
double r533421 = r533415 / r533420;
double r533422 = r533419 - r533421;
double r533423 = 5.95569082529366e-131;
bool r533424 = r533407 <= r533423;
double r533425 = 7.1565475002938845e+289;
bool r533426 = r533407 <= r533425;
double r533427 = 1.0;
double r533428 = r533426 ? r533422 : r533427;
double r533429 = r533424 ? r533410 : r533428;
double r533430 = r533412 ? r533422 : r533429;
double r533431 = r533409 ? r533410 : r533430;
return r533431;
}




Bits error versus x




Bits error versus y
| Original | 31.8 |
|---|---|
| Target | 31.5 |
| Herbie | 12.3 |
if (* x x) < 1.1009678461595335e-279 or 2.3515556900183252e-150 < (* x x) < 5.95569082529366e-131Initial program 29.2
Taylor expanded around 0 10.2
if 1.1009678461595335e-279 < (* x x) < 2.3515556900183252e-150 or 5.95569082529366e-131 < (* x x) < 7.1565475002938845e+289Initial program 16.1
rmApplied div-sub16.1
Simplified16.2
Simplified15.7
if 7.1565475002938845e+289 < (* x x) Initial program 61.4
Taylor expanded around inf 8.9
Final simplification12.3
herbie shell --seed 2020062 +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))))