\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 -5.810291952691062 \cdot 10^{115}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(1\right)\right)\\
\mathbf{elif}\;x \le -2.9463808085280802 \cdot 10^{-149}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x \cdot x - \left(y \cdot 4\right) \cdot y}}\right)\right)\\
\mathbf{elif}\;x \le 9.05045019517546565 \cdot 10^{-190}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \le 1.3661811917011361 \cdot 10^{-63}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}{x \cdot x - \left(y \cdot 4\right) \cdot y}}\\
\mathbf{elif}\;x \le 4.9502099980031536 \cdot 10^{39}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(1\right)\right)\\
\end{array}double f(double x, double y) {
double r739122 = x;
double r739123 = r739122 * r739122;
double r739124 = y;
double r739125 = 4.0;
double r739126 = r739124 * r739125;
double r739127 = r739126 * r739124;
double r739128 = r739123 - r739127;
double r739129 = r739123 + r739127;
double r739130 = r739128 / r739129;
return r739130;
}
double f(double x, double y) {
double r739131 = x;
double r739132 = -5.810291952691062e+115;
bool r739133 = r739131 <= r739132;
double r739134 = 1.0;
double r739135 = expm1(r739134);
double r739136 = log1p(r739135);
double r739137 = -2.9463808085280802e-149;
bool r739138 = r739131 <= r739137;
double r739139 = y;
double r739140 = 4.0;
double r739141 = r739139 * r739140;
double r739142 = r739141 * r739139;
double r739143 = fma(r739131, r739131, r739142);
double r739144 = r739131 * r739131;
double r739145 = r739144 - r739142;
double r739146 = r739143 / r739145;
double r739147 = r739134 / r739146;
double r739148 = expm1(r739147);
double r739149 = log1p(r739148);
double r739150 = 9.050450195175466e-190;
bool r739151 = r739131 <= r739150;
double r739152 = -1.0;
double r739153 = 1.366181191701136e-63;
bool r739154 = r739131 <= r739153;
double r739155 = 4.9502099980031536e+39;
bool r739156 = r739131 <= r739155;
double r739157 = r739156 ? r739152 : r739136;
double r739158 = r739154 ? r739147 : r739157;
double r739159 = r739151 ? r739152 : r739158;
double r739160 = r739138 ? r739149 : r739159;
double r739161 = r739133 ? r739136 : r739160;
return r739161;
}




Bits error versus x




Bits error versus y
| Original | 31.5 |
|---|---|
| Target | 31.3 |
| Herbie | 14.1 |
if x < -5.810291952691062e+115 or 4.9502099980031536e+39 < x Initial program 48.0
rmApplied clear-num48.0
Simplified48.0
rmApplied log1p-expm1-u48.0
Taylor expanded around inf 12.1
if -5.810291952691062e+115 < x < -2.9463808085280802e-149Initial program 16.4
rmApplied clear-num16.4
Simplified16.4
rmApplied log1p-expm1-u16.4
if -2.9463808085280802e-149 < x < 9.050450195175466e-190 or 1.366181191701136e-63 < x < 4.9502099980031536e+39Initial program 26.0
Taylor expanded around 0 13.3
if 9.050450195175466e-190 < x < 1.366181191701136e-63Initial program 19.3
rmApplied clear-num19.3
Simplified19.3
Final simplification14.1
herbie shell --seed 2020021 +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))))