Average Error: 24.7 → 9.9
Time: 22.2s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} = -\infty:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -8.092252279900194308962547602369097847561 \cdot 10^{-185}:\\ \;\;\;\;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}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -0.0:\\ \;\;\;\;x - \left(1 \cdot \frac{z}{\frac{t}{y}} + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 5.203881094970987385400751435625381890776 \cdot 10^{295}:\\ \;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\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}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} = -\infty:\\
\;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\

\mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -8.092252279900194308962547602369097847561 \cdot 10^{-185}:\\
\;\;\;\;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}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -0.0:\\
\;\;\;\;x - \left(1 \cdot \frac{z}{\frac{t}{y}} + \frac{\log 1}{t}\right)\\

\mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 5.203881094970987385400751435625381890776 \cdot 10^{295}:\\
\;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\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 r213922 = x;
        double r213923 = 1.0;
        double r213924 = y;
        double r213925 = r213923 - r213924;
        double r213926 = z;
        double r213927 = exp(r213926);
        double r213928 = r213924 * r213927;
        double r213929 = r213925 + r213928;
        double r213930 = log(r213929);
        double r213931 = t;
        double r213932 = r213930 / r213931;
        double r213933 = r213922 - r213932;
        return r213933;
}

double f(double x, double y, double z, double t) {
        double r213934 = 1.0;
        double r213935 = y;
        double r213936 = r213934 - r213935;
        double r213937 = z;
        double r213938 = exp(r213937);
        double r213939 = r213935 * r213938;
        double r213940 = r213936 + r213939;
        double r213941 = log(r213940);
        double r213942 = t;
        double r213943 = r213941 / r213942;
        double r213944 = -inf.0;
        bool r213945 = r213943 <= r213944;
        double r213946 = x;
        double r213947 = 0.5;
        double r213948 = 2.0;
        double r213949 = pow(r213937, r213948);
        double r213950 = r213947 * r213949;
        double r213951 = r213950 + r213937;
        double r213952 = r213935 * r213951;
        double r213953 = r213934 + r213952;
        double r213954 = log(r213953);
        double r213955 = r213954 / r213942;
        double r213956 = r213946 - r213955;
        double r213957 = -8.092252279900194e-185;
        bool r213958 = r213943 <= r213957;
        double r213959 = cbrt(r213939);
        double r213960 = r213959 * r213959;
        double r213961 = r213960 * r213959;
        double r213962 = r213936 + r213961;
        double r213963 = log(r213962);
        double r213964 = r213963 / r213942;
        double r213965 = r213946 - r213964;
        double r213966 = -0.0;
        bool r213967 = r213943 <= r213966;
        double r213968 = r213942 / r213935;
        double r213969 = r213937 / r213968;
        double r213970 = r213934 * r213969;
        double r213971 = log(r213934);
        double r213972 = r213971 / r213942;
        double r213973 = r213970 + r213972;
        double r213974 = r213946 - r213973;
        double r213975 = 5.203881094970987e+295;
        bool r213976 = r213943 <= r213975;
        double r213977 = 1.0;
        double r213978 = r213942 / r213941;
        double r213979 = r213977 / r213978;
        double r213980 = r213946 - r213979;
        double r213981 = r213976 ? r213980 : r213956;
        double r213982 = r213967 ? r213974 : r213981;
        double r213983 = r213958 ? r213965 : r213982;
        double r213984 = r213945 ? r213956 : r213983;
        return r213984;
}

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.7
Target15.9
Herbie9.9
\[\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 4 regimes
  2. if (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < -inf.0 or 5.203881094970987e+295 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t)

    1. Initial program 63.7

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

      \[\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}\]
    4. Taylor expanded around 0 13.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}\]
    5. Simplified13.3

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

    if -inf.0 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < -8.092252279900194e-185

    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.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 -8.092252279900194e-185 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < -0.0

    1. Initial program 11.0

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

      \[\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}\]
    4. Taylor expanded around 0 17.3

      \[\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}\]
    5. Simplified17.3

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

      \[\leadsto \color{blue}{x - \left(1 \cdot \frac{z \cdot y}{t} + \frac{\log 1}{t}\right)}\]
    7. Using strategy rm
    8. Applied associate-/l*10.4

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

    if -0.0 < (/ (log (+ (- 1.0 y) (* y (exp z)))) t) < 5.203881094970987e+295

    1. Initial program 10.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} = -\infty:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -8.092252279900194308962547602369097847561 \cdot 10^{-185}:\\ \;\;\;\;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}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -0.0:\\ \;\;\;\;x - \left(1 \cdot \frac{z}{\frac{t}{y}} + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 5.203881094970987385400751435625381890776 \cdot 10^{295}:\\ \;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\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 2019304 
(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.88746230882079466e119) (- (- 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)))