Average Error: 25.1 → 7.9
Time: 6.8s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.19950611994967936 \cdot 10^{-16}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \left(\frac{z}{t} \cdot y\right) + \frac{\log 1}{t}\right)\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;z \le -3.19950611994967936 \cdot 10^{-16}:\\
\;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right)\right)}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r228967 = x;
        double r228968 = 1.0;
        double r228969 = y;
        double r228970 = r228968 - r228969;
        double r228971 = z;
        double r228972 = exp(r228971);
        double r228973 = r228969 * r228972;
        double r228974 = r228970 + r228973;
        double r228975 = log(r228974);
        double r228976 = t;
        double r228977 = r228975 / r228976;
        double r228978 = r228967 - r228977;
        return r228978;
}

double f(double x, double y, double z, double t) {
        double r228979 = z;
        double r228980 = -3.1995061199496794e-16;
        bool r228981 = r228979 <= r228980;
        double r228982 = x;
        double r228983 = 1.0;
        double r228984 = y;
        double r228985 = r228983 - r228984;
        double r228986 = cbrt(r228984);
        double r228987 = r228986 * r228986;
        double r228988 = exp(r228979);
        double r228989 = r228986 * r228988;
        double r228990 = r228987 * r228989;
        double r228991 = r228985 + r228990;
        double r228992 = log(r228991);
        double r228993 = t;
        double r228994 = r228992 / r228993;
        double r228995 = r228982 - r228994;
        double r228996 = r228979 / r228993;
        double r228997 = r228996 * r228984;
        double r228998 = r228983 * r228997;
        double r228999 = log(r228983);
        double r229000 = r228999 / r228993;
        double r229001 = r228998 + r229000;
        double r229002 = r228982 - r229001;
        double r229003 = r228981 ? r228995 : r229002;
        return r229003;
}

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

Original25.1
Target16.3
Herbie7.9
\[\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 z < -3.1995061199496794e-16

    1. Initial program 11.5

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

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

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

    if -3.1995061199496794e-16 < z

    1. Initial program 31.3

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

      \[\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. Simplified7.1

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

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

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

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

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

Reproduce

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