x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\begin{array}{l}
\mathbf{if}\;z \le -2.7490043504004516 \cdot 10^{-5}:\\
\;\;\;\;x - \frac{\log \left(1 + \left(y \cdot e^{z} - y\right)\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + \frac{\log 1}{t}\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 <= -2.7490043504004516e-05)) {
VAR = ((double) (x - (((double) log(((double) (1.0 + ((double) (((double) (y * ((double) exp(z)))) - y)))))) / t)));
} else {
VAR = ((double) (x - ((double) (((double) (1.0 * (((double) (z * y)) / t))) + (((double) log(1.0)) / t)))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 25.1 |
|---|---|
| Target | 16.0 |
| Herbie | 8.6 |
if z < -2.7490043504004516e-5Initial program 11.5
rmApplied sub-neg11.5
Applied associate-+l+11.5
Simplified11.5
if -2.7490043504004516e-5 < z Initial program 31.2
Taylor expanded around 0 7.2
Simplified7.2
Taylor expanded around 0 7.3
Final simplification8.6
herbie shell --seed 2020182
(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 (/ (/ (neg 0.5) (* y t)) (* z z))) (* (/ (neg 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)))