Average Error: 24.6 → 8.4
Time: 23.3s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -45345376.066928721964359283447265625:\\ \;\;\;\;x - \frac{\log \left(1 - y \cdot \left(1 - e^{z}\right)\right)}{t}\\ \mathbf{elif}\;z \le -7.24128778827560918094582322562071502946 \cdot 10^{-136}:\\ \;\;\;\;x - \log \left(1 - y \cdot \left(\left(-z\right) - {z}^{2} \cdot \left(\frac{1}{6} \cdot z + \frac{1}{2}\right)\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + \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}\;z \le -45345376.066928721964359283447265625:\\
\;\;\;\;x - \frac{\log \left(1 - y \cdot \left(1 - e^{z}\right)\right)}{t}\\

\mathbf{elif}\;z \le -7.24128778827560918094582322562071502946 \cdot 10^{-136}:\\
\;\;\;\;x - \log \left(1 - y \cdot \left(\left(-z\right) - {z}^{2} \cdot \left(\frac{1}{6} \cdot z + \frac{1}{2}\right)\right)\right) \cdot \frac{1}{t}\\

\mathbf{else}:\\
\;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + \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 r209035 = x;
        double r209036 = 1.0;
        double r209037 = y;
        double r209038 = r209036 - r209037;
        double r209039 = z;
        double r209040 = exp(r209039);
        double r209041 = r209037 * r209040;
        double r209042 = r209038 + r209041;
        double r209043 = log(r209042);
        double r209044 = t;
        double r209045 = r209043 / r209044;
        double r209046 = r209035 - r209045;
        return r209046;
}

double f(double x, double y, double z, double t) {
        double r209047 = z;
        double r209048 = -45345376.06692872;
        bool r209049 = r209047 <= r209048;
        double r209050 = x;
        double r209051 = 1.0;
        double r209052 = y;
        double r209053 = 1.0;
        double r209054 = exp(r209047);
        double r209055 = r209053 - r209054;
        double r209056 = r209052 * r209055;
        double r209057 = r209051 - r209056;
        double r209058 = log(r209057);
        double r209059 = t;
        double r209060 = r209058 / r209059;
        double r209061 = r209050 - r209060;
        double r209062 = -7.241287788275609e-136;
        bool r209063 = r209047 <= r209062;
        double r209064 = -r209047;
        double r209065 = 2.0;
        double r209066 = pow(r209047, r209065);
        double r209067 = 0.16666666666666666;
        double r209068 = r209067 * r209047;
        double r209069 = 0.5;
        double r209070 = r209068 + r209069;
        double r209071 = r209066 * r209070;
        double r209072 = r209064 - r209071;
        double r209073 = r209052 * r209072;
        double r209074 = r209051 - r209073;
        double r209075 = log(r209074);
        double r209076 = r209053 / r209059;
        double r209077 = r209075 * r209076;
        double r209078 = r209050 - r209077;
        double r209079 = r209047 * r209052;
        double r209080 = r209079 / r209059;
        double r209081 = r209051 * r209080;
        double r209082 = log(r209051);
        double r209083 = r209082 / r209059;
        double r209084 = 0.5;
        double r209085 = r209066 * r209052;
        double r209086 = r209085 / r209059;
        double r209087 = r209084 * r209086;
        double r209088 = r209083 + r209087;
        double r209089 = r209081 + r209088;
        double r209090 = r209050 - r209089;
        double r209091 = r209063 ? r209078 : r209090;
        double r209092 = r209049 ? r209061 : r209091;
        return r209092;
}

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.6
Target16.1
Herbie8.4
\[\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 3 regimes
  2. if z < -45345376.06692872

    1. Initial program 11.4

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

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

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

    if -45345376.06692872 < z < -7.241287788275609e-136

    1. Initial program 28.0

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

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

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

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

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

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

    if -7.241287788275609e-136 < z

    1. Initial program 30.4

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

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

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

      \[\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. Recombined 3 regimes into one program.
  4. Final simplification8.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -45345376.066928721964359283447265625:\\ \;\;\;\;x - \frac{\log \left(1 - y \cdot \left(1 - e^{z}\right)\right)}{t}\\ \mathbf{elif}\;z \le -7.24128778827560918094582322562071502946 \cdot 10^{-136}:\\ \;\;\;\;x - \log \left(1 - y \cdot \left(\left(-z\right) - {z}^{2} \cdot \left(\frac{1}{6} \cdot z + \frac{1}{2}\right)\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \end{array}\]

Reproduce

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