x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\begin{array}{l}
\mathbf{if}\;z \le -1.822483888526443226180116178080030181202 \cdot 10^{-106}:\\
\;\;\;\;x - 1 \cdot \frac{\log \left(1 + y \cdot \mathsf{expm1}\left(z\right)\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{1}{\frac{t}{\mathsf{fma}\left(0.5, {z}^{2} \cdot y, \mathsf{fma}\left(1, z \cdot y, \log 1\right)\right)}}\\
\end{array}double f(double x, double y, double z, double t) {
double r280126 = x;
double r280127 = 1.0;
double r280128 = y;
double r280129 = r280127 - r280128;
double r280130 = z;
double r280131 = exp(r280130);
double r280132 = r280128 * r280131;
double r280133 = r280129 + r280132;
double r280134 = log(r280133);
double r280135 = t;
double r280136 = r280134 / r280135;
double r280137 = r280126 - r280136;
return r280137;
}
double f(double x, double y, double z, double t) {
double r280138 = z;
double r280139 = -1.8224838885264432e-106;
bool r280140 = r280138 <= r280139;
double r280141 = x;
double r280142 = 1.0;
double r280143 = 1.0;
double r280144 = y;
double r280145 = expm1(r280138);
double r280146 = r280144 * r280145;
double r280147 = r280143 + r280146;
double r280148 = log(r280147);
double r280149 = t;
double r280150 = r280148 / r280149;
double r280151 = r280142 * r280150;
double r280152 = r280141 - r280151;
double r280153 = 0.5;
double r280154 = 2.0;
double r280155 = pow(r280138, r280154);
double r280156 = r280155 * r280144;
double r280157 = r280138 * r280144;
double r280158 = log(r280143);
double r280159 = fma(r280143, r280157, r280158);
double r280160 = fma(r280153, r280156, r280159);
double r280161 = r280149 / r280160;
double r280162 = r280142 / r280161;
double r280163 = r280141 - r280162;
double r280164 = r280140 ? r280152 : r280163;
return r280164;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 25.1 |
|---|---|
| Target | 16.4 |
| Herbie | 8.6 |
if z < -1.8224838885264432e-106Initial program 16.2
rmApplied sub-neg16.2
Applied associate-+l+13.9
Simplified11.7
rmApplied clear-num11.8
rmApplied div-inv11.8
Applied associate-/r*11.8
rmApplied pow111.8
Applied log-pow11.8
Applied add-sqr-sqrt11.8
Applied times-frac11.8
Applied *-un-lft-identity11.8
Applied add-sqr-sqrt11.8
Applied times-frac11.8
Applied times-frac11.8
Simplified11.8
Simplified11.7
if -1.8224838885264432e-106 < z Initial program 31.3
rmApplied sub-neg31.3
Applied associate-+l+15.6
Simplified11.2
rmApplied clear-num11.2
Taylor expanded around 0 6.5
Simplified6.5
Final simplification8.6
herbie shell --seed 2019356 +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.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)))