\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}\;y \le -6.85410439611574166 \cdot 10^{153}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.2415409052957577 \cdot 10^{-113}:\\
\;\;\;\;\log \left(e^{\frac{x}{\mathsf{fma}\left(4, \frac{{y}^{2}}{x}, x\right)}}\right) - \frac{y \cdot 4}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{y}}\\
\mathbf{elif}\;y \le 2.5006885111970022 \cdot 10^{-302}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 6.6423911005969367 \cdot 10^{153}:\\
\;\;\;\;\log \left(e^{\frac{x}{\mathsf{fma}\left(4, \frac{{y}^{2}}{x}, x\right)}}\right) - \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 r629344 = x;
double r629345 = r629344 * r629344;
double r629346 = y;
double r629347 = 4.0;
double r629348 = r629346 * r629347;
double r629349 = r629348 * r629346;
double r629350 = r629345 - r629349;
double r629351 = r629345 + r629349;
double r629352 = r629350 / r629351;
return r629352;
}
double f(double x, double y) {
double r629353 = y;
double r629354 = -6.854104396115742e+153;
bool r629355 = r629353 <= r629354;
double r629356 = -1.0;
double r629357 = -1.2415409052957577e-113;
bool r629358 = r629353 <= r629357;
double r629359 = x;
double r629360 = 4.0;
double r629361 = 2.0;
double r629362 = pow(r629353, r629361);
double r629363 = r629362 / r629359;
double r629364 = fma(r629360, r629363, r629359);
double r629365 = r629359 / r629364;
double r629366 = exp(r629365);
double r629367 = log(r629366);
double r629368 = r629353 * r629360;
double r629369 = r629368 * r629353;
double r629370 = fma(r629359, r629359, r629369);
double r629371 = r629370 / r629353;
double r629372 = r629368 / r629371;
double r629373 = r629367 - r629372;
double r629374 = 2.500688511197002e-302;
bool r629375 = r629353 <= r629374;
double r629376 = 1.0;
double r629377 = 6.642391100596937e+153;
bool r629378 = r629353 <= r629377;
double r629379 = r629378 ? r629373 : r629356;
double r629380 = r629375 ? r629376 : r629379;
double r629381 = r629358 ? r629373 : r629380;
double r629382 = r629355 ? r629356 : r629381;
return r629382;
}




Bits error versus x




Bits error versus y
| Original | 31.8 |
|---|---|
| Target | 31.4 |
| Herbie | 5.8 |
if y < -6.854104396115742e+153 or 6.642391100596937e+153 < y Initial program 64.0
Taylor expanded around 0 9.2
if -6.854104396115742e+153 < y < -1.2415409052957577e-113 or 2.500688511197002e-302 < y < 6.642391100596937e+153Initial program 18.9
rmApplied div-sub18.9
Simplified18.5
Simplified18.6
Taylor expanded around 0 2.7
Simplified2.7
rmApplied add-log-exp2.7
if -1.2415409052957577e-113 < y < 2.500688511197002e-302Initial program 28.0
Taylor expanded around inf 11.2
Final simplification5.8
herbie shell --seed 2020081 +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))))