x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\begin{array}{l}
\mathbf{if}\;z \le -5.701067561750732141737610406634812570077 \cdot 10^{-215}:\\
\;\;\;\;x - \frac{\log \left(\sqrt{\mathsf{fma}\left(y, \mathsf{expm1}\left(z\right), 1\right)}\right) + \frac{1}{2} \cdot \log \left(\mathsf{fma}\left(y, \mathsf{expm1}\left(z\right), 1\right)\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{fma}\left(y, \mathsf{fma}\left(z \cdot 0.5, z, 1 \cdot z\right), \log 1\right)}{t}\\
\end{array}double f(double x, double y, double z, double t) {
double r12675296 = x;
double r12675297 = 1.0;
double r12675298 = y;
double r12675299 = r12675297 - r12675298;
double r12675300 = z;
double r12675301 = exp(r12675300);
double r12675302 = r12675298 * r12675301;
double r12675303 = r12675299 + r12675302;
double r12675304 = log(r12675303);
double r12675305 = t;
double r12675306 = r12675304 / r12675305;
double r12675307 = r12675296 - r12675306;
return r12675307;
}
double f(double x, double y, double z, double t) {
double r12675308 = z;
double r12675309 = -5.701067561750732e-215;
bool r12675310 = r12675308 <= r12675309;
double r12675311 = x;
double r12675312 = y;
double r12675313 = expm1(r12675308);
double r12675314 = 1.0;
double r12675315 = fma(r12675312, r12675313, r12675314);
double r12675316 = sqrt(r12675315);
double r12675317 = log(r12675316);
double r12675318 = 0.5;
double r12675319 = log(r12675315);
double r12675320 = r12675318 * r12675319;
double r12675321 = r12675317 + r12675320;
double r12675322 = t;
double r12675323 = r12675321 / r12675322;
double r12675324 = r12675311 - r12675323;
double r12675325 = 0.5;
double r12675326 = r12675308 * r12675325;
double r12675327 = r12675314 * r12675308;
double r12675328 = fma(r12675326, r12675308, r12675327);
double r12675329 = log(r12675314);
double r12675330 = fma(r12675312, r12675328, r12675329);
double r12675331 = r12675330 / r12675322;
double r12675332 = r12675311 - r12675331;
double r12675333 = r12675310 ? r12675324 : r12675332;
return r12675333;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 25.0 |
|---|---|
| Target | 15.7 |
| Herbie | 9.0 |
if z < -5.701067561750732e-215Initial program 19.3
rmApplied sub-neg19.3
Applied associate-+l+13.5
Simplified13.5
rmApplied add-log-exp13.5
Simplified11.1
rmApplied add-sqr-sqrt11.1
Applied log-prod11.1
rmApplied pow1/211.1
Applied log-pow11.1
if -5.701067561750732e-215 < z Initial program 31.2
rmApplied sub-neg31.2
Applied associate-+l+15.2
Simplified15.2
Taylor expanded around 0 6.8
Simplified6.8
Final simplification9.0
herbie shell --seed 2019192 +o rules:numerics
(FPCore (x y z t)
:name "System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2"
: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)))