Average Error: 24.9 → 8.1
Time: 8.7s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;e^{z} \le 0.0:\\ \;\;\;\;x - \log \left(\left(1 - y\right) + y \cdot e^{z}\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \left(\left(z \cdot y\right) \cdot \frac{1}{t}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;e^{z} \le 0.0:\\
\;\;\;\;x - \log \left(\left(1 - y\right) + y \cdot e^{z}\right) \cdot \frac{1}{t}\\

\mathbf{else}:\\
\;\;\;\;x - \left(1 \cdot \left(\left(z \cdot y\right) \cdot \frac{1}{t}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r393308 = x;
        double r393309 = 1.0;
        double r393310 = y;
        double r393311 = r393309 - r393310;
        double r393312 = z;
        double r393313 = exp(r393312);
        double r393314 = r393310 * r393313;
        double r393315 = r393311 + r393314;
        double r393316 = log(r393315);
        double r393317 = t;
        double r393318 = r393316 / r393317;
        double r393319 = r393308 - r393318;
        return r393319;
}

double f(double x, double y, double z, double t) {
        double r393320 = z;
        double r393321 = exp(r393320);
        double r393322 = 0.0;
        bool r393323 = r393321 <= r393322;
        double r393324 = x;
        double r393325 = 1.0;
        double r393326 = y;
        double r393327 = r393325 - r393326;
        double r393328 = r393326 * r393321;
        double r393329 = r393327 + r393328;
        double r393330 = log(r393329);
        double r393331 = 1.0;
        double r393332 = t;
        double r393333 = r393331 / r393332;
        double r393334 = r393330 * r393333;
        double r393335 = r393324 - r393334;
        double r393336 = r393320 * r393326;
        double r393337 = r393336 * r393333;
        double r393338 = r393325 * r393337;
        double r393339 = log(r393325);
        double r393340 = r393339 / r393332;
        double r393341 = 0.5;
        double r393342 = 2.0;
        double r393343 = pow(r393320, r393342);
        double r393344 = r393343 * r393326;
        double r393345 = r393344 / r393332;
        double r393346 = r393341 * r393345;
        double r393347 = r393340 + r393346;
        double r393348 = r393338 + r393347;
        double r393349 = r393324 - r393348;
        double r393350 = r393323 ? r393335 : r393349;
        return r393350;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.9
Target15.6
Herbie8.1
\[\begin{array}{l} \mathbf{if}\;z \lt -2.88746230882079466 \cdot 10^{119}:\\ \;\;\;\;\left(x - \frac{\frac{-0.5}{y \cdot t}}{z \cdot z}\right) - \frac{-0.5}{y \cdot t} \cdot \frac{\frac{2}{z}}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + z \cdot y\right)}{t}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (exp z) < 0.0

    1. Initial program 11.0

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Using strategy rm
    3. Applied div-inv11.1

      \[\leadsto x - \color{blue}{\log \left(\left(1 - y\right) + y \cdot e^{z}\right) \cdot \frac{1}{t}}\]

    if 0.0 < (exp z)

    1. Initial program 30.5

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Taylor expanded around 0 6.8

      \[\leadsto x - \color{blue}{\left(1 \cdot \frac{z \cdot y}{t} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)}\]
    3. Using strategy rm
    4. Applied div-inv6.9

      \[\leadsto x - \left(1 \cdot \color{blue}{\left(\left(z \cdot y\right) \cdot \frac{1}{t}\right)} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{z} \le 0.0:\\ \;\;\;\;x - \log \left(\left(1 - y\right) + y \cdot e^{z}\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \left(\left(z \cdot y\right) \cdot \frac{1}{t}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 
(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)))