\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 r764028 = x;
double r764029 = r764028 * r764028;
double r764030 = y;
double r764031 = 4.0;
double r764032 = r764030 * r764031;
double r764033 = r764032 * r764030;
double r764034 = r764029 - r764033;
double r764035 = r764029 + r764033;
double r764036 = r764034 / r764035;
return r764036;
}
double f(double x, double y) {
double r764037 = y;
double r764038 = -7.710738992849757e+142;
bool r764039 = r764037 <= r764038;
double r764040 = -1.0;
double r764041 = -1.3841596065667632e-97;
bool r764042 = r764037 <= r764041;
double r764043 = x;
double r764044 = r764043 * r764043;
double r764045 = 4.0;
double r764046 = r764037 * r764045;
double r764047 = r764046 * r764037;
double r764048 = fma(r764043, r764043, r764047);
double r764049 = r764044 / r764048;
double r764050 = r764047 / r764048;
double r764051 = r764049 - r764050;
double r764052 = 1.1196094733529732e-55;
bool r764053 = r764037 <= r764052;
double r764054 = 1.0;
double r764055 = 28161126.972837694;
bool r764056 = r764037 <= r764055;
double r764057 = 4.011625031578035e+38;
bool r764058 = r764037 <= r764057;
double r764059 = 2.1620145518824135e+107;
bool r764060 = r764037 <= r764059;
double r764061 = -r764047;
double r764062 = fma(r764043, r764043, r764061);
double r764063 = r764062 / r764048;
double r764064 = exp(r764063);
double r764065 = log(r764064);
double r764066 = 4.367447801126625e+128;
bool r764067 = r764037 <= r764066;
double r764068 = r764067 ? r764054 : r764040;
double r764069 = r764060 ? r764065 : r764068;
double r764070 = r764058 ? r764054 : r764069;
double r764071 = r764056 ? r764051 : r764070;
double r764072 = r764053 ? r764054 : r764071;
double r764073 = r764042 ? r764051 : r764072;
double r764074 = r764039 ? r764040 : r764073;
return r764074;
}




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