Average Error: 23.9 → 5.7
Time: 7.1s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.1198126899025023 \cdot 10^{-4}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\ \mathbf{elif}\;z \le 5.154733228884571 \cdot 10^{-35}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{\frac{{z}^{2} \cdot y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;z \le -3.1198126899025023 \cdot 10^{-4}:\\
\;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\

\mathbf{elif}\;z \le 5.154733228884571 \cdot 10^{-35}:\\
\;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{\frac{{z}^{2} \cdot y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r277924 = x;
        double r277925 = 1.0;
        double r277926 = y;
        double r277927 = r277925 - r277926;
        double r277928 = z;
        double r277929 = exp(r277928);
        double r277930 = r277926 * r277929;
        double r277931 = r277927 + r277930;
        double r277932 = log(r277931);
        double r277933 = t;
        double r277934 = r277932 / r277933;
        double r277935 = r277924 - r277934;
        return r277935;
}

double f(double x, double y, double z, double t) {
        double r277936 = z;
        double r277937 = -0.00031198126899025023;
        bool r277938 = r277936 <= r277937;
        double r277939 = x;
        double r277940 = 1.0;
        double r277941 = y;
        double r277942 = r277940 - r277941;
        double r277943 = exp(r277936);
        double r277944 = r277941 * r277943;
        double r277945 = cbrt(r277944);
        double r277946 = r277945 * r277945;
        double r277947 = r277946 * r277945;
        double r277948 = r277942 + r277947;
        double r277949 = log(r277948);
        double r277950 = t;
        double r277951 = r277949 / r277950;
        double r277952 = r277939 - r277951;
        double r277953 = 5.154733228884571e-35;
        bool r277954 = r277936 <= r277953;
        double r277955 = r277936 * r277941;
        double r277956 = r277955 / r277950;
        double r277957 = r277940 * r277956;
        double r277958 = log(r277940);
        double r277959 = r277958 / r277950;
        double r277960 = 0.5;
        double r277961 = 2.0;
        double r277962 = pow(r277936, r277961);
        double r277963 = r277962 * r277941;
        double r277964 = cbrt(r277950);
        double r277965 = r277964 * r277964;
        double r277966 = r277963 / r277965;
        double r277967 = r277966 / r277964;
        double r277968 = r277960 * r277967;
        double r277969 = r277959 + r277968;
        double r277970 = r277957 + r277969;
        double r277971 = r277939 - r277970;
        double r277972 = 0.5;
        double r277973 = r277972 * r277962;
        double r277974 = r277973 + r277936;
        double r277975 = r277941 * r277974;
        double r277976 = r277940 + r277975;
        double r277977 = log(r277976);
        double r277978 = r277977 / r277950;
        double r277979 = r277939 - r277978;
        double r277980 = r277954 ? r277971 : r277979;
        double r277981 = r277938 ? r277952 : r277980;
        return r277981;
}

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

Original23.9
Target13.1
Herbie5.7
\[\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 z < -0.00031198126899025023

    1. Initial program 0.9

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

      \[\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 -0.00031198126899025023 < z < 5.154733228884571e-35

    1. Initial program 31.1

      \[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 add-cube-cbrt6.8

      \[\leadsto x - \left(1 \cdot \frac{z \cdot y}{t} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}\right)\right)\]
    5. Applied associate-/r*6.8

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

    if 5.154733228884571e-35 < z

    1. Initial program 27.2

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

      \[\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. Simplified12.3

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

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

Reproduce

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