Average Error: 24.6 → 8.4
Time: 25.8s
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 - \frac{\log \left(1 - \left(-\left(y \cdot \left({z}^{2} \cdot \left(\frac{1}{2} + z \cdot \frac{1}{6}\right)\right) + z \cdot y\right)\right)\right)}{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 - \frac{\log \left(1 - \left(-\left(y \cdot \left({z}^{2} \cdot \left(\frac{1}{2} + z \cdot \frac{1}{6}\right)\right) + z \cdot y\right)\right)\right)}{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 r173745 = x;
        double r173746 = 1.0;
        double r173747 = y;
        double r173748 = r173746 - r173747;
        double r173749 = z;
        double r173750 = exp(r173749);
        double r173751 = r173747 * r173750;
        double r173752 = r173748 + r173751;
        double r173753 = log(r173752);
        double r173754 = t;
        double r173755 = r173753 / r173754;
        double r173756 = r173745 - r173755;
        return r173756;
}

double f(double x, double y, double z, double t) {
        double r173757 = z;
        double r173758 = -45345376.06692872;
        bool r173759 = r173757 <= r173758;
        double r173760 = x;
        double r173761 = 1.0;
        double r173762 = y;
        double r173763 = 1.0;
        double r173764 = exp(r173757);
        double r173765 = r173763 - r173764;
        double r173766 = r173762 * r173765;
        double r173767 = r173761 - r173766;
        double r173768 = log(r173767);
        double r173769 = t;
        double r173770 = r173768 / r173769;
        double r173771 = r173760 - r173770;
        double r173772 = -7.241287788275609e-136;
        bool r173773 = r173757 <= r173772;
        double r173774 = 2.0;
        double r173775 = pow(r173757, r173774);
        double r173776 = 0.5;
        double r173777 = 0.16666666666666666;
        double r173778 = r173757 * r173777;
        double r173779 = r173776 + r173778;
        double r173780 = r173775 * r173779;
        double r173781 = r173762 * r173780;
        double r173782 = r173757 * r173762;
        double r173783 = r173781 + r173782;
        double r173784 = -r173783;
        double r173785 = r173761 - r173784;
        double r173786 = log(r173785);
        double r173787 = r173786 / r173769;
        double r173788 = r173760 - r173787;
        double r173789 = r173782 / r173769;
        double r173790 = r173761 * r173789;
        double r173791 = log(r173761);
        double r173792 = r173791 / r173769;
        double r173793 = 0.5;
        double r173794 = r173775 * r173762;
        double r173795 = r173794 / r173769;
        double r173796 = r173793 * r173795;
        double r173797 = r173792 + r173796;
        double r173798 = r173790 + r173797;
        double r173799 = r173760 - r173798;
        double r173800 = r173773 ? r173788 : r173799;
        double r173801 = r173759 ? r173771 : r173800;
        return r173801;
}

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. Taylor expanded around 0 12.3

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

      \[\leadsto x - \frac{\log \left(1 - \color{blue}{\left(-\left(y \cdot \left({z}^{2} \cdot \left(\frac{1}{2} + z \cdot \frac{1}{6}\right)\right) + z \cdot y\right)\right)}\right)}{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. 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 - \frac{\log \left(1 - \left(-\left(y \cdot \left({z}^{2} \cdot \left(\frac{1}{2} + z \cdot \frac{1}{6}\right)\right) + z \cdot y\right)\right)\right)}{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)))