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

\end{array}
double f(double x, double y, double z, double t) {
        double r180571 = x;
        double r180572 = 1.0;
        double r180573 = y;
        double r180574 = r180572 - r180573;
        double r180575 = z;
        double r180576 = exp(r180575);
        double r180577 = r180573 * r180576;
        double r180578 = r180574 + r180577;
        double r180579 = log(r180578);
        double r180580 = t;
        double r180581 = r180579 / r180580;
        double r180582 = r180571 - r180581;
        return r180582;
}

double f(double x, double y, double z, double t) {
        double r180583 = z;
        double r180584 = -9.795130714803148e-08;
        bool r180585 = r180583 <= r180584;
        double r180586 = x;
        double r180587 = 1.0;
        double r180588 = y;
        double r180589 = r180587 - r180588;
        double r180590 = exp(r180583);
        double r180591 = r180588 * r180590;
        double r180592 = cbrt(r180591);
        double r180593 = r180592 * r180592;
        double r180594 = r180593 * r180592;
        double r180595 = r180589 + r180594;
        double r180596 = log(r180595);
        double r180597 = t;
        double r180598 = r180596 / r180597;
        double r180599 = r180586 - r180598;
        double r180600 = log(r180587);
        double r180601 = 0.5;
        double r180602 = 2.0;
        double r180603 = pow(r180583, r180602);
        double r180604 = r180601 * r180603;
        double r180605 = r180587 * r180583;
        double r180606 = r180604 + r180605;
        double r180607 = r180588 * r180606;
        double r180608 = r180600 + r180607;
        double r180609 = r180608 / r180597;
        double r180610 = r180586 - r180609;
        double r180611 = r180585 ? r180599 : r180610;
        return r180611;
}

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.8
Target16.5
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 2 regimes
  2. if z < -9.795130714803148e-08

    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 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}\]

    if -9.795130714803148e-08 < z

    1. Initial program 30.9

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

      \[\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 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}\]
    5. Simplified7.0

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

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

Reproduce

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