Average Error: 25.4 → 8.6
Time: 20.8s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le \frac{-350719738609737}{1125899906842624}:\\ \;\;\;\;x - \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{\log \left(1 + \left(e^{z} - 1\right) \cdot y\right)}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{\frac{t}{\log 1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + 1 \cdot z\right)}}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;z \le \frac{-350719738609737}{1125899906842624}:\\
\;\;\;\;x - \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{\log \left(1 + \left(e^{z} - 1\right) \cdot y\right)}{\sqrt[3]{t}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r236568 = x;
        double r236569 = 1.0;
        double r236570 = y;
        double r236571 = r236569 - r236570;
        double r236572 = z;
        double r236573 = exp(r236572);
        double r236574 = r236570 * r236573;
        double r236575 = r236571 + r236574;
        double r236576 = log(r236575);
        double r236577 = t;
        double r236578 = r236576 / r236577;
        double r236579 = r236568 - r236578;
        return r236579;
}

double f(double x, double y, double z, double t) {
        double r236580 = z;
        double r236581 = -350719738609737.0;
        double r236582 = 1125899906842624.0;
        double r236583 = r236581 / r236582;
        bool r236584 = r236580 <= r236583;
        double r236585 = x;
        double r236586 = 1.0;
        double r236587 = t;
        double r236588 = cbrt(r236587);
        double r236589 = r236588 * r236588;
        double r236590 = r236586 / r236589;
        double r236591 = 1.0;
        double r236592 = exp(r236580);
        double r236593 = r236592 - r236586;
        double r236594 = y;
        double r236595 = r236593 * r236594;
        double r236596 = r236591 + r236595;
        double r236597 = log(r236596);
        double r236598 = r236597 / r236588;
        double r236599 = r236590 * r236598;
        double r236600 = r236585 - r236599;
        double r236601 = log(r236591);
        double r236602 = 2.0;
        double r236603 = r236591 / r236602;
        double r236604 = 2.0;
        double r236605 = pow(r236580, r236604);
        double r236606 = r236603 * r236605;
        double r236607 = r236591 * r236580;
        double r236608 = r236606 + r236607;
        double r236609 = r236594 * r236608;
        double r236610 = r236601 + r236609;
        double r236611 = r236587 / r236610;
        double r236612 = r236586 / r236611;
        double r236613 = r236585 - r236612;
        double r236614 = r236584 ? r236600 : r236613;
        return r236614;
}

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.4
Target16.5
Herbie8.6
\[\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 < -0.3115017031960372

    1. Initial program 10.9

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

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

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

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

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

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

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

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

    if -0.3115017031960372 < z

    1. Initial program 31.3

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

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

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

      \[\leadsto x - \frac{\log \left(1 + \color{blue}{\left(e^{z} - 1\right) \cdot y}\right)}{t}\]
    6. Using strategy rm
    7. Applied clear-num16.7

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

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

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

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

Reproduce

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