x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\begin{array}{l}
\mathbf{if}\;z \le -2.1255354070387358 \cdot 10^{-69}:\\
\;\;\;\;x - \frac{\sqrt[3]{{\left(\log \left(\mathsf{fma}\left(\mathsf{expm1}\left(z\right), y, 1\right)\right)\right)}^{3}}}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{fma}\left(0.5, {z}^{2} \cdot y, \mathsf{fma}\left(1, z \cdot y, \log 1\right)\right)}{t}\\
\end{array}double f(double x, double y, double z, double t) {
double r243694 = x;
double r243695 = 1.0;
double r243696 = y;
double r243697 = r243695 - r243696;
double r243698 = z;
double r243699 = exp(r243698);
double r243700 = r243696 * r243699;
double r243701 = r243697 + r243700;
double r243702 = log(r243701);
double r243703 = t;
double r243704 = r243702 / r243703;
double r243705 = r243694 - r243704;
return r243705;
}
double f(double x, double y, double z, double t) {
double r243706 = z;
double r243707 = -2.1255354070387358e-69;
bool r243708 = r243706 <= r243707;
double r243709 = x;
double r243710 = expm1(r243706);
double r243711 = y;
double r243712 = 1.0;
double r243713 = fma(r243710, r243711, r243712);
double r243714 = log(r243713);
double r243715 = 3.0;
double r243716 = pow(r243714, r243715);
double r243717 = cbrt(r243716);
double r243718 = t;
double r243719 = r243717 / r243718;
double r243720 = r243709 - r243719;
double r243721 = 0.5;
double r243722 = 2.0;
double r243723 = pow(r243706, r243722);
double r243724 = r243723 * r243711;
double r243725 = r243706 * r243711;
double r243726 = log(r243712);
double r243727 = fma(r243712, r243725, r243726);
double r243728 = fma(r243721, r243724, r243727);
double r243729 = r243728 / r243718;
double r243730 = r243709 - r243729;
double r243731 = r243708 ? r243720 : r243730;
return r243731;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 24.9 |
|---|---|
| Target | 16.0 |
| Herbie | 8.6 |
if z < -2.1255354070387358e-69Initial program 14.9
rmApplied sub-neg14.9
Applied associate-+l+13.3
Simplified11.9
rmApplied add-cbrt-cube11.9
Simplified11.9
if -2.1255354070387358e-69 < z Initial program 30.7
rmApplied sub-neg30.7
Applied associate-+l+15.0
Simplified10.9
rmApplied add-cbrt-cube10.9
Simplified10.9
Taylor expanded around 0 6.7
Simplified6.7
Final simplification8.6
herbie shell --seed 2020039 +o rules:numerics
(FPCore (x y z t)
:name "System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2"
:precision binary64
:herbie-target
(if (< z -2.8874623088207947e+119) (- (- x (/ (/ (- 0.5) (* y t)) (* z z))) (* (/ (- 0.5) (* y t)) (/ (/ 2 z) (* z z)))) (- x (/ (log (+ 1 (* z y))) t)))
(- x (/ (log (+ (- 1 y) (* y (exp z)))) t)))