Average Error: 24.9 → 8.8
Time: 6.8s
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.99993958631142354:\\ \;\;\;\;x - \frac{\sqrt[3]{{\left(\log \left(1 - \left(1 - e^{z}\right) \cdot y\right)\right)}^{3}}}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \frac{1}{\frac{t}{z \cdot y}} + \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.99993958631142354:\\
\;\;\;\;x - \frac{\sqrt[3]{{\left(\log \left(1 - \left(1 - e^{z}\right) \cdot y\right)\right)}^{3}}}{t}\\

\mathbf{else}:\\
\;\;\;\;x - \left(1 \cdot \frac{1}{\frac{t}{z \cdot y}} + \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 r285545 = x;
        double r285546 = 1.0;
        double r285547 = y;
        double r285548 = r285546 - r285547;
        double r285549 = z;
        double r285550 = exp(r285549);
        double r285551 = r285547 * r285550;
        double r285552 = r285548 + r285551;
        double r285553 = log(r285552);
        double r285554 = t;
        double r285555 = r285553 / r285554;
        double r285556 = r285545 - r285555;
        return r285556;
}

double f(double x, double y, double z, double t) {
        double r285557 = z;
        double r285558 = exp(r285557);
        double r285559 = 0.9999395863114235;
        bool r285560 = r285558 <= r285559;
        double r285561 = x;
        double r285562 = 1.0;
        double r285563 = 1.0;
        double r285564 = r285563 - r285558;
        double r285565 = y;
        double r285566 = r285564 * r285565;
        double r285567 = r285562 - r285566;
        double r285568 = log(r285567);
        double r285569 = 3.0;
        double r285570 = pow(r285568, r285569);
        double r285571 = cbrt(r285570);
        double r285572 = t;
        double r285573 = r285571 / r285572;
        double r285574 = r285561 - r285573;
        double r285575 = r285557 * r285565;
        double r285576 = r285572 / r285575;
        double r285577 = r285563 / r285576;
        double r285578 = r285562 * r285577;
        double r285579 = log(r285562);
        double r285580 = r285579 / r285572;
        double r285581 = 0.5;
        double r285582 = 2.0;
        double r285583 = pow(r285557, r285582);
        double r285584 = r285583 * r285565;
        double r285585 = r285584 / r285572;
        double r285586 = r285581 * r285585;
        double r285587 = r285580 + r285586;
        double r285588 = r285578 + r285587;
        double r285589 = r285561 - r285588;
        double r285590 = r285560 ? r285574 : r285589;
        return r285590;
}

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
Target16.0
Herbie8.8
\[\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.9999395863114235

    1. Initial program 12.3

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

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

      \[\leadsto x - \frac{\log \left(1 - \color{blue}{\left(1 - e^{z}\right) \cdot y}\right)}{t}\]
    5. Using strategy rm
    6. Applied add-cbrt-cube12.4

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

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

    if 0.9999395863114235 < (exp z)

    1. Initial program 30.3

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

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

      \[\leadsto x - \frac{\log \left(1 - \color{blue}{\left(1 - e^{z}\right) \cdot y}\right)}{t}\]
    5. Taylor expanded around 0 7.3

      \[\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)}\]
    6. Using strategy rm
    7. Applied clear-num7.3

      \[\leadsto x - \left(1 \cdot \color{blue}{\frac{1}{\frac{t}{z \cdot y}}} + \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.8

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

Reproduce

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