x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\begin{array}{l}
\mathbf{if}\;z \leq -495.4882184164917:\\
\;\;\;\;x - \frac{\log \left(1 + \left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right) - y\right)\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \left(1 \cdot \left(y \cdot \frac{z}{t}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \left(y \cdot \frac{z}{\frac{t}{z}}\right)\right)\right)\\
\end{array}double code(double x, double y, double z, double t) {
return ((double) (x - (((double) log(((double) (((double) (1.0 - y)) + ((double) (y * ((double) exp(z)))))))) / t)));
}
double code(double x, double y, double z, double t) {
double VAR;
if ((z <= -495.4882184164917)) {
VAR = ((double) (x - (((double) log(((double) (1.0 + ((double) (((double) (((double) (((double) cbrt(y)) * ((double) cbrt(y)))) * ((double) (((double) cbrt(y)) * ((double) exp(z)))))) - y)))))) / t)));
} else {
VAR = ((double) (x - ((double) (((double) (1.0 * ((double) (y * (z / t))))) + ((double) ((((double) log(1.0)) / t) + ((double) (0.5 * ((double) (y * (z / (t / z))))))))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 25.6 |
|---|---|
| Target | 16.7 |
| Herbie | 8.5 |
if z < -495.48821841649169Initial program 12.5
Simplified12.5
rmApplied add-cube-cbrt12.5
Applied associate-*l*12.5
Simplified12.5
if -495.48821841649169 < z Initial program 31.0
Simplified16.5
Taylor expanded around 0 7.8
Simplified6.8
Final simplification8.5
herbie shell --seed 2020196
(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.0 z) (* z z)))) (- x (/ (log (+ 1.0 (* z y))) t)))
(- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))