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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r307371 = x;
        double r307372 = 1.0;
        double r307373 = y;
        double r307374 = r307372 - r307373;
        double r307375 = z;
        double r307376 = exp(r307375);
        double r307377 = r307373 * r307376;
        double r307378 = r307374 + r307377;
        double r307379 = log(r307378);
        double r307380 = t;
        double r307381 = r307379 / r307380;
        double r307382 = r307371 - r307381;
        return r307382;
}

double f(double x, double y, double z, double t) {
        double r307383 = z;
        double r307384 = exp(r307383);
        double r307385 = 0.0;
        bool r307386 = r307384 <= r307385;
        double r307387 = x;
        double r307388 = 1.0;
        double r307389 = 1.0;
        double r307390 = r307384 - r307389;
        double r307391 = y;
        double r307392 = r307390 * r307391;
        double r307393 = r307388 + r307392;
        double r307394 = log(r307393);
        double r307395 = 3.0;
        double r307396 = pow(r307394, r307395);
        double r307397 = cbrt(r307396);
        double r307398 = t;
        double r307399 = r307389 / r307398;
        double r307400 = r307397 * r307399;
        double r307401 = r307387 - r307400;
        double r307402 = log(r307388);
        double r307403 = 0.5;
        double r307404 = 2.0;
        double r307405 = pow(r307383, r307404);
        double r307406 = r307403 * r307405;
        double r307407 = r307388 * r307383;
        double r307408 = r307406 + r307407;
        double r307409 = r307391 * r307408;
        double r307410 = r307402 + r307409;
        double r307411 = r307410 / r307398;
        double r307412 = r307387 - r307411;
        double r307413 = r307386 ? r307401 : r307412;
        return r307413;
}

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.0
Target16.1
Herbie8.5
\[\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.6

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

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

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

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

      \[\leadsto x - \color{blue}{\log \left(1 + \left(e^{z} - 1\right) \cdot y\right) \cdot \frac{1}{t}}\]
    8. Using strategy rm
    9. Applied add-cbrt-cube11.7

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

      \[\leadsto x - \sqrt[3]{\color{blue}{{\left(\log \left(1 + \left(e^{z} - 1\right) \cdot y\right)\right)}^{3}}} \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 7.2

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

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

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

Reproduce

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