x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\begin{array}{l}
\mathbf{if}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} = -\infty:\\
\;\;\;\;x - \left(1 \cdot \left(\frac{z}{t} \cdot y\right) + \frac{\log 1}{t}\right)\\
\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -1.46432279035300478 \cdot 10^{-124}:\\
\;\;\;\;x - \frac{2 \cdot \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right) + \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right)}{t}\\
\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 2.2345576967229745 \cdot 10^{-140}:\\
\;\;\;\;x - \left(1 \cdot \left(z \cdot \frac{y}{t}\right) + \frac{\log 1}{t}\right)\\
\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 1.91498230609953577 \cdot 10^{302}:\\
\;\;\;\;x - \frac{2 \cdot \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right) + \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\log \left(1 + \left({z}^{2} \cdot \left(\frac{1}{2} + z \cdot \frac{1}{6}\right) + z\right) \cdot y\right)}{t}\\
\end{array}double code(double x, double y, double z, double t) {
return (x - (log(((1.0 - y) + (y * exp(z)))) / t));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= -inf.0)) {
VAR = (x - ((1.0 * ((z / t) * y)) + (log(1.0) / t)));
} else {
double VAR_1;
if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= -1.4643227903530048e-124)) {
VAR_1 = (x - (((2.0 * log(cbrt(((1.0 - y) + (y * exp(z)))))) + log(cbrt(((1.0 - y) + (y * exp(z)))))) / t));
} else {
double VAR_2;
if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= 2.2345576967229745e-140)) {
VAR_2 = (x - ((1.0 * (z * (y / t))) + (log(1.0) / t)));
} else {
double VAR_3;
if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= 1.9149823060995358e+302)) {
VAR_3 = (x - (((2.0 * log(cbrt(((1.0 - y) + (y * exp(z)))))) + log(cbrt(((1.0 - y) + (y * exp(z)))))) / t));
} else {
VAR_3 = (x - (log((1.0 + (((pow(z, 2.0) * (0.5 + (z * 0.16666666666666666))) + z) * y))) / t));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 24.7 |
|---|---|
| Target | 15.9 |
| Herbie | 9.6 |
if (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < -inf.0Initial program 64.0
Taylor expanded around 0 14.1
rmApplied associate-/l*22.1
rmApplied associate-/r/14.7
if -inf.0 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < -1.4643227903530048e-124 or 2.2345576967229745e-140 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < 1.9149823060995358e+302Initial program 5.3
rmApplied add-cube-cbrt5.2
Applied log-prod5.2
Simplified5.2
if -1.4643227903530048e-124 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < 2.2345576967229745e-140Initial program 25.6
Taylor expanded around 0 21.4
rmApplied *-un-lft-identity21.4
Applied times-frac16.3
Simplified16.3
if 1.9149823060995358e+302 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) Initial program 62.7
rmApplied sub-neg62.7
Applied associate-+l+26.1
Simplified26.1
Taylor expanded around 0 13.5
Simplified13.5
Final simplification9.6
herbie shell --seed 2020106
(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)))