\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 -7.71073899284975746 \cdot 10^{142}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.38415960656676321 \cdot 10^{-97}:\\
\;\;\;\;\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}\;y \le 1.1196094733529732 \cdot 10^{-55}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 28161126.972837694:\\
\;\;\;\;\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}\;y \le 4.01162503157803517 \cdot 10^{38}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \le 2.16201455188241352 \cdot 10^{107}:\\
\;\;\;\;\log \left(e^{\frac{\mathsf{fma}\left(x, x, -\left(y \cdot 4\right) \cdot y\right)}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}}\right)\\
\mathbf{elif}\;y \le 4.36744780112662469 \cdot 10^{128}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double f(double x, double y) {
double r644484 = x;
double r644485 = r644484 * r644484;
double r644486 = y;
double r644487 = 4.0;
double r644488 = r644486 * r644487;
double r644489 = r644488 * r644486;
double r644490 = r644485 - r644489;
double r644491 = r644485 + r644489;
double r644492 = r644490 / r644491;
return r644492;
}
double f(double x, double y) {
double r644493 = y;
double r644494 = -7.710738992849757e+142;
bool r644495 = r644493 <= r644494;
double r644496 = -1.0;
double r644497 = -1.3841596065667632e-97;
bool r644498 = r644493 <= r644497;
double r644499 = x;
double r644500 = r644499 * r644499;
double r644501 = 4.0;
double r644502 = r644493 * r644501;
double r644503 = r644502 * r644493;
double r644504 = fma(r644499, r644499, r644503);
double r644505 = r644500 / r644504;
double r644506 = r644503 / r644504;
double r644507 = r644505 - r644506;
double r644508 = 1.1196094733529732e-55;
bool r644509 = r644493 <= r644508;
double r644510 = 1.0;
double r644511 = 28161126.972837694;
bool r644512 = r644493 <= r644511;
double r644513 = 4.011625031578035e+38;
bool r644514 = r644493 <= r644513;
double r644515 = 2.1620145518824135e+107;
bool r644516 = r644493 <= r644515;
double r644517 = -r644503;
double r644518 = fma(r644499, r644499, r644517);
double r644519 = r644518 / r644504;
double r644520 = exp(r644519);
double r644521 = log(r644520);
double r644522 = 4.367447801126625e+128;
bool r644523 = r644493 <= r644522;
double r644524 = r644523 ? r644510 : r644496;
double r644525 = r644516 ? r644521 : r644524;
double r644526 = r644514 ? r644510 : r644525;
double r644527 = r644512 ? r644507 : r644526;
double r644528 = r644509 ? r644510 : r644527;
double r644529 = r644498 ? r644507 : r644528;
double r644530 = r644495 ? r644496 : r644529;
return r644530;
}




Bits error versus x




Bits error versus y
| Original | 32.3 |
|---|---|
| Target | 32.0 |
| Herbie | 13.6 |
if y < -7.710738992849757e+142 or 4.367447801126625e+128 < y Initial program 59.1
Simplified59.1
Taylor expanded around 0 8.6
if -7.710738992849757e+142 < y < -1.3841596065667632e-97 or 1.1196094733529732e-55 < y < 28161126.972837694Initial program 17.4
Simplified17.4
rmApplied div-sub17.4
if -1.3841596065667632e-97 < y < 1.1196094733529732e-55 or 28161126.972837694 < y < 4.011625031578035e+38 or 2.1620145518824135e+107 < y < 4.367447801126625e+128Initial program 25.0
Simplified25.0
Taylor expanded around inf 14.8
if 4.011625031578035e+38 < y < 2.1620145518824135e+107Initial program 13.9
Simplified13.9
rmApplied fma-neg13.9
rmApplied add-log-exp13.9
Final simplification13.6
herbie shell --seed 2020047 +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))))