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

\mathbf{elif}\;\left(1 - y\right) + y \cdot e^{z} \le 1:\\
\;\;\;\;x - \left(1 \cdot \left(z \cdot \frac{y}{t}\right) + \frac{\log 1}{t}\right)\\

\mathbf{else}:\\
\;\;\;\;x - \frac{2 \cdot \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right) + \log \left(\sqrt[3]{\left(1 - y\right) + y \cdot e^{z}}\right)}{t}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r229688 = x;
        double r229689 = 1.0;
        double r229690 = y;
        double r229691 = r229689 - r229690;
        double r229692 = z;
        double r229693 = exp(r229692);
        double r229694 = r229690 * r229693;
        double r229695 = r229691 + r229694;
        double r229696 = log(r229695);
        double r229697 = t;
        double r229698 = r229696 / r229697;
        double r229699 = r229688 - r229698;
        return r229699;
}

double f(double x, double y, double z, double t) {
        double r229700 = 1.0;
        double r229701 = y;
        double r229702 = r229700 - r229701;
        double r229703 = z;
        double r229704 = exp(r229703);
        double r229705 = r229701 * r229704;
        double r229706 = r229702 + r229705;
        double r229707 = 0.0;
        bool r229708 = r229706 <= r229707;
        double r229709 = x;
        double r229710 = 0.5;
        double r229711 = 2.0;
        double r229712 = pow(r229703, r229711);
        double r229713 = r229710 * r229712;
        double r229714 = r229713 + r229703;
        double r229715 = r229701 * r229714;
        double r229716 = r229700 + r229715;
        double r229717 = log(r229716);
        double r229718 = t;
        double r229719 = r229717 / r229718;
        double r229720 = r229709 - r229719;
        bool r229721 = r229706 <= r229700;
        double r229722 = r229701 / r229718;
        double r229723 = r229703 * r229722;
        double r229724 = r229700 * r229723;
        double r229725 = log(r229700);
        double r229726 = r229725 / r229718;
        double r229727 = r229724 + r229726;
        double r229728 = r229709 - r229727;
        double r229729 = cbrt(r229706);
        double r229730 = log(r229729);
        double r229731 = r229711 * r229730;
        double r229732 = r229731 + r229730;
        double r229733 = r229732 / r229718;
        double r229734 = r229709 - r229733;
        double r229735 = r229721 ? r229728 : r229734;
        double r229736 = r229708 ? r229720 : r229735;
        return r229736;
}

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.2
Herbie9.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 3 regimes
  2. if (+ (- 1.0 y) (* y (exp z))) < 0.0

    1. Initial program 64.0

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

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

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

    if 0.0 < (+ (- 1.0 y) (* y (exp z))) < 1.0

    1. Initial program 12.3

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

      \[\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. Simplified16.5

      \[\leadsto x - \frac{\color{blue}{y \cdot \left(0.5 \cdot {z}^{2} + 1 \cdot z\right) + \log 1}}{t}\]
    4. Taylor expanded around 0 11.1

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

      \[\leadsto x - \left(1 \cdot \frac{z \cdot y}{\color{blue}{1 \cdot t}} + \frac{\log 1}{t}\right)\]
    7. Applied times-frac9.3

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

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

    if 1.0 < (+ (- 1.0 y) (* y (exp z)))

    1. Initial program 3.4

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

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

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

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

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

Reproduce

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