1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\begin{array}{l}
\mathbf{if}\;y \le -4.38962381722942814 \cdot 10^{28} \lor \neg \left(y \le 103782153027757.69\right):\\
\;\;\;\;\mathsf{fma}\left(1, \frac{x}{{y}^{2}} - \frac{x}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\
\end{array}double f(double x, double y) {
double r931981 = 1.0;
double r931982 = x;
double r931983 = r931981 - r931982;
double r931984 = y;
double r931985 = r931983 * r931984;
double r931986 = r931984 + r931981;
double r931987 = r931985 / r931986;
double r931988 = r931981 - r931987;
return r931988;
}
double f(double x, double y) {
double r931989 = y;
double r931990 = -4.389623817229428e+28;
bool r931991 = r931989 <= r931990;
double r931992 = 103782153027757.69;
bool r931993 = r931989 <= r931992;
double r931994 = !r931993;
bool r931995 = r931991 || r931994;
double r931996 = 1.0;
double r931997 = x;
double r931998 = 2.0;
double r931999 = pow(r931989, r931998);
double r932000 = r931997 / r931999;
double r932001 = r931997 / r931989;
double r932002 = r932000 - r932001;
double r932003 = fma(r931996, r932002, r931997);
double r932004 = r931996 - r931997;
double r932005 = r932004 * r931989;
double r932006 = r931989 + r931996;
double r932007 = r932005 / r932006;
double r932008 = r931996 - r932007;
double r932009 = r931995 ? r932003 : r932008;
return r932009;
}




Bits error versus x




Bits error versus y
| Original | 22.7 |
|---|---|
| Target | 0.2 |
| Herbie | 7.4 |
if y < -4.389623817229428e+28 or 103782153027757.69 < y Initial program 47.0
Simplified29.1
rmApplied add-cube-cbrt29.9
Applied *-un-lft-identity29.9
Applied times-frac29.9
Taylor expanded around inf 14.1
Simplified14.1
if -4.389623817229428e+28 < y < 103782153027757.69Initial program 1.4
Final simplification7.4
herbie shell --seed 2020025 +o rules:numerics
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x))))
(- 1 (/ (* (- 1 x) y) (+ y 1))))