\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 \le -7.928259414816123188229698239228701594261 \cdot 10^{152}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \le -1.670806219743054366544845033863121817394 \cdot 10^{-99}:\\
\;\;\;\;\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}\;x \le 3.339425016971985733812234822017933716285 \cdot 10^{-120}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 371427111337525632:\\
\;\;\;\;\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 r867346 = x;
double r867347 = r867346 * r867346;
double r867348 = y;
double r867349 = 4.0;
double r867350 = r867348 * r867349;
double r867351 = r867350 * r867348;
double r867352 = r867347 - r867351;
double r867353 = r867347 + r867351;
double r867354 = r867352 / r867353;
return r867354;
}
double f(double x, double y) {
double r867355 = x;
double r867356 = -7.928259414816123e+152;
bool r867357 = r867355 <= r867356;
double r867358 = 1.0;
double r867359 = -1.6708062197430544e-99;
bool r867360 = r867355 <= r867359;
double r867361 = r867355 * r867355;
double r867362 = y;
double r867363 = 4.0;
double r867364 = r867362 * r867363;
double r867365 = r867364 * r867362;
double r867366 = fma(r867355, r867355, r867365);
double r867367 = r867361 / r867366;
double r867368 = r867365 / r867366;
double r867369 = r867367 - r867368;
double r867370 = 3.339425016971986e-120;
bool r867371 = r867355 <= r867370;
double r867372 = -1.0;
double r867373 = 3.714271113375256e+17;
bool r867374 = r867355 <= r867373;
double r867375 = r867374 ? r867369 : r867358;
double r867376 = r867371 ? r867372 : r867375;
double r867377 = r867360 ? r867369 : r867376;
double r867378 = r867357 ? r867358 : r867377;
return r867378;
}




Bits error versus x




Bits error versus y
| Original | 31.3 |
|---|---|
| Target | 31.0 |
| Herbie | 12.7 |
if x < -7.928259414816123e+152 or 3.714271113375256e+17 < x Initial program 49.2
Taylor expanded around inf 12.2
if -7.928259414816123e+152 < x < -1.6708062197430544e-99 or 3.339425016971986e-120 < x < 3.714271113375256e+17Initial program 15.6
rmApplied div-sub15.6
Simplified15.6
Simplified15.6
if -1.6708062197430544e-99 < x < 3.339425016971986e-120Initial program 26.8
Taylor expanded around 0 10.3
Final simplification12.7
herbie shell --seed 2019350 +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))))