Average Error: 25.1 → 8.1
Time: 30.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 5.133580128615205696306839549874698191978 \cdot 10^{-9}:\\ \;\;\;\;x - \frac{\log \left(\sqrt[3]{y \cdot e^{z}} \cdot \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) + \left(1 - y\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(\frac{\left(z \cdot z\right) \cdot y}{\frac{t}{0.5}} + \left(\frac{\log 1}{t} + 1 \cdot \left(y \cdot \frac{z}{t}\right)\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 5.133580128615205696306839549874698191978 \cdot 10^{-9}:\\
\;\;\;\;x - \frac{\log \left(\sqrt[3]{y \cdot e^{z}} \cdot \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) + \left(1 - y\right)\right)}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r18330372 = x;
        double r18330373 = 1.0;
        double r18330374 = y;
        double r18330375 = r18330373 - r18330374;
        double r18330376 = z;
        double r18330377 = exp(r18330376);
        double r18330378 = r18330374 * r18330377;
        double r18330379 = r18330375 + r18330378;
        double r18330380 = log(r18330379);
        double r18330381 = t;
        double r18330382 = r18330380 / r18330381;
        double r18330383 = r18330372 - r18330382;
        return r18330383;
}

double f(double x, double y, double z, double t) {
        double r18330384 = z;
        double r18330385 = exp(r18330384);
        double r18330386 = 5.133580128615206e-09;
        bool r18330387 = r18330385 <= r18330386;
        double r18330388 = x;
        double r18330389 = y;
        double r18330390 = r18330389 * r18330385;
        double r18330391 = cbrt(r18330390);
        double r18330392 = r18330391 * r18330391;
        double r18330393 = r18330391 * r18330392;
        double r18330394 = 1.0;
        double r18330395 = r18330394 - r18330389;
        double r18330396 = r18330393 + r18330395;
        double r18330397 = log(r18330396);
        double r18330398 = t;
        double r18330399 = r18330397 / r18330398;
        double r18330400 = r18330388 - r18330399;
        double r18330401 = r18330384 * r18330384;
        double r18330402 = r18330401 * r18330389;
        double r18330403 = 0.5;
        double r18330404 = r18330398 / r18330403;
        double r18330405 = r18330402 / r18330404;
        double r18330406 = log(r18330394);
        double r18330407 = r18330406 / r18330398;
        double r18330408 = r18330384 / r18330398;
        double r18330409 = r18330389 * r18330408;
        double r18330410 = r18330394 * r18330409;
        double r18330411 = r18330407 + r18330410;
        double r18330412 = r18330405 + r18330411;
        double r18330413 = r18330388 - r18330412;
        double r18330414 = r18330387 ? r18330400 : r18330413;
        return r18330414;
}

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

Original25.1
Target16.6
Herbie8.1
\[\begin{array}{l} \mathbf{if}\;z \lt -2.887462308820794658905265984545350618896 \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) < 5.133580128615206e-09

    1. Initial program 11.8

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

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

    if 5.133580128615206e-09 < (exp z)

    1. Initial program 30.9

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

      \[\leadsto x - \color{blue}{\left(1 \cdot \frac{z \cdot y}{t} + \left(0.5 \cdot \frac{{z}^{2} \cdot y}{t} + \frac{\log 1}{t}\right)\right)}\]
    3. Simplified7.5

      \[\leadsto x - \color{blue}{\left(\left(\frac{y \cdot z}{t} \cdot 1 + \frac{\log 1}{t}\right) + \frac{y \cdot \left(z \cdot z\right)}{\frac{t}{0.5}}\right)}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity7.5

      \[\leadsto x - \left(\left(\frac{y \cdot z}{\color{blue}{1 \cdot t}} \cdot 1 + \frac{\log 1}{t}\right) + \frac{y \cdot \left(z \cdot z\right)}{\frac{t}{0.5}}\right)\]
    6. Applied times-frac6.5

      \[\leadsto x - \left(\left(\color{blue}{\left(\frac{y}{1} \cdot \frac{z}{t}\right)} \cdot 1 + \frac{\log 1}{t}\right) + \frac{y \cdot \left(z \cdot z\right)}{\frac{t}{0.5}}\right)\]
    7. Simplified6.5

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

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

Reproduce

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