Average Error: 25.2 → 8.2
Time: 31.1s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;e^{z} \le 0.1554480115940285456233027616690378636122:\\ \;\;\;\;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{else}:\\ \;\;\;\;x - \frac{y \cdot \left(0.5 \cdot {z}^{2} + 1 \cdot z\right) + \log 1}{t}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;e^{z} \le 0.1554480115940285456233027616690378636122:\\
\;\;\;\;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{else}:\\
\;\;\;\;x - \frac{y \cdot \left(0.5 \cdot {z}^{2} + 1 \cdot z\right) + \log 1}{t}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r219624 = x;
        double r219625 = 1.0;
        double r219626 = y;
        double r219627 = r219625 - r219626;
        double r219628 = z;
        double r219629 = exp(r219628);
        double r219630 = r219626 * r219629;
        double r219631 = r219627 + r219630;
        double r219632 = log(r219631);
        double r219633 = t;
        double r219634 = r219632 / r219633;
        double r219635 = r219624 - r219634;
        return r219635;
}

double f(double x, double y, double z, double t) {
        double r219636 = z;
        double r219637 = exp(r219636);
        double r219638 = 0.15544801159402855;
        bool r219639 = r219637 <= r219638;
        double r219640 = x;
        double r219641 = 1.0;
        double r219642 = y;
        double r219643 = r219641 - r219642;
        double r219644 = r219642 * r219637;
        double r219645 = cbrt(r219644);
        double r219646 = r219645 * r219645;
        double r219647 = r219646 * r219645;
        double r219648 = r219643 + r219647;
        double r219649 = log(r219648);
        double r219650 = t;
        double r219651 = r219649 / r219650;
        double r219652 = r219640 - r219651;
        double r219653 = 0.5;
        double r219654 = 2.0;
        double r219655 = pow(r219636, r219654);
        double r219656 = r219653 * r219655;
        double r219657 = r219641 * r219636;
        double r219658 = r219656 + r219657;
        double r219659 = r219642 * r219658;
        double r219660 = log(r219641);
        double r219661 = r219659 + r219660;
        double r219662 = r219661 / r219650;
        double r219663 = r219640 - r219662;
        double r219664 = r219639 ? r219652 : r219663;
        return r219664;
}

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.2
Target16.1
Herbie8.2
\[\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 2 regimes
  2. if (exp z) < 0.15544801159402855

    1. Initial program 11.3

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

      \[\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.15544801159402855 < (exp z)

    1. Initial program 31.0

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

      \[\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.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{z} \le 0.1554480115940285456233027616690378636122:\\ \;\;\;\;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{else}:\\ \;\;\;\;x - \frac{y \cdot \left(0.5 \cdot {z}^{2} + 1 \cdot z\right) + \log 1}{t}\\ \end{array}\]

Reproduce

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