x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\begin{array}{l}
\mathbf{if}\;z \le -7.557323451675197409924132573708902840764 \cdot 10^{-160}:\\
\;\;\;\;x - \frac{3}{\frac{t}{\log \left(\sqrt[3]{\mathsf{fma}\left(\mathsf{expm1}\left(z\right), y, 1\right)}\right)}}\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(1, \frac{z \cdot y}{t}, \mathsf{fma}\left(0.5, \frac{{z}^{2} \cdot y}{t}, \frac{\log 1}{t}\right)\right)\\
\end{array}double f(double x, double y, double z, double t) {
double r167293 = x;
double r167294 = 1.0;
double r167295 = y;
double r167296 = r167294 - r167295;
double r167297 = z;
double r167298 = exp(r167297);
double r167299 = r167295 * r167298;
double r167300 = r167296 + r167299;
double r167301 = log(r167300);
double r167302 = t;
double r167303 = r167301 / r167302;
double r167304 = r167293 - r167303;
return r167304;
}
double f(double x, double y, double z, double t) {
double r167305 = z;
double r167306 = -7.557323451675197e-160;
bool r167307 = r167305 <= r167306;
double r167308 = x;
double r167309 = 3.0;
double r167310 = t;
double r167311 = expm1(r167305);
double r167312 = y;
double r167313 = 1.0;
double r167314 = fma(r167311, r167312, r167313);
double r167315 = cbrt(r167314);
double r167316 = log(r167315);
double r167317 = r167310 / r167316;
double r167318 = r167309 / r167317;
double r167319 = r167308 - r167318;
double r167320 = r167305 * r167312;
double r167321 = r167320 / r167310;
double r167322 = 0.5;
double r167323 = 2.0;
double r167324 = pow(r167305, r167323);
double r167325 = r167324 * r167312;
double r167326 = r167325 / r167310;
double r167327 = log(r167313);
double r167328 = r167327 / r167310;
double r167329 = fma(r167322, r167326, r167328);
double r167330 = fma(r167313, r167321, r167329);
double r167331 = r167308 - r167330;
double r167332 = r167307 ? r167319 : r167331;
return r167332;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 24.7 |
|---|---|
| Target | 15.9 |
| Herbie | 8.5 |
if z < -7.557323451675197e-160Initial program 17.7
Simplified11.0
rmApplied clear-num11.0
rmApplied add-cube-cbrt11.1
Applied log-prod11.1
Simplified11.1
rmApplied distribute-lft1-in11.1
Applied *-un-lft-identity11.1
Applied times-frac11.1
Applied associate-/r*11.1
Simplified11.1
if -7.557323451675197e-160 < z Initial program 31.0
Simplified11.1
Taylor expanded around 0 6.3
Simplified6.3
Final simplification8.5
herbie shell --seed 2019304 +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.88746230882079466e119) (- (- 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)))