Average Error: 25.4 → 8.4
Time: 18.9s
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.9999999353825346215529634719132445752621:\\ \;\;\;\;x - \frac{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}} \cdot \frac{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{\frac{\sqrt[3]{t}}{z}} \cdot \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) - \frac{\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.9999999353825346215529634719132445752621:\\
\;\;\;\;x - \frac{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}} \cdot \frac{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}{\sqrt[3]{t}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r297700 = x;
        double r297701 = 1.0;
        double r297702 = y;
        double r297703 = r297701 - r297702;
        double r297704 = z;
        double r297705 = exp(r297704);
        double r297706 = r297702 * r297705;
        double r297707 = r297703 + r297706;
        double r297708 = log(r297707);
        double r297709 = t;
        double r297710 = r297708 / r297709;
        double r297711 = r297700 - r297710;
        return r297711;
}

double f(double x, double y, double z, double t) {
        double r297712 = z;
        double r297713 = exp(r297712);
        double r297714 = 0.9999999353825346;
        bool r297715 = r297713 <= r297714;
        double r297716 = x;
        double r297717 = 1.0;
        double r297718 = y;
        double r297719 = r297718 * r297713;
        double r297720 = r297717 + r297719;
        double r297721 = r297720 - r297718;
        double r297722 = log(r297721);
        double r297723 = cbrt(r297722);
        double r297724 = t;
        double r297725 = cbrt(r297724);
        double r297726 = r297725 * r297725;
        double r297727 = r297726 / r297723;
        double r297728 = r297723 / r297727;
        double r297729 = r297723 / r297725;
        double r297730 = r297728 * r297729;
        double r297731 = r297716 - r297730;
        double r297732 = r297725 / r297712;
        double r297733 = r297718 / r297732;
        double r297734 = r297717 / r297726;
        double r297735 = r297733 * r297734;
        double r297736 = r297716 - r297735;
        double r297737 = log(r297717);
        double r297738 = r297737 / r297724;
        double r297739 = r297736 - r297738;
        double r297740 = r297715 ? r297731 : r297739;
        return r297740;
}

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.4
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 (exp z) < 0.9999999353825346

    1. Initial program 11.2

      \[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) + y \cdot e^{z}\right)}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}\]
    4. Applied add-cube-cbrt11.5

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

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

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

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

    if 0.9999999353825346 < (exp z)

    1. Initial program 31.8

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

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

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

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

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

      \[\leadsto \left(x - \color{blue}{\frac{y}{\frac{t}{z \cdot 1}}}\right) - \frac{\log 1}{t}\]
    8. Simplified6.7

      \[\leadsto \left(x - \frac{y}{\color{blue}{\frac{t}{1 \cdot z}}}\right) - \frac{\log 1}{t}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt6.9

      \[\leadsto \left(x - \frac{y}{\frac{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}{1 \cdot z}}\right) - \frac{\log 1}{t}\]
    11. Applied times-frac6.9

      \[\leadsto \left(x - \frac{y}{\color{blue}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{1} \cdot \frac{\sqrt[3]{t}}{z}}}\right) - \frac{\log 1}{t}\]
    12. Applied *-un-lft-identity6.9

      \[\leadsto \left(x - \frac{\color{blue}{1 \cdot y}}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{1} \cdot \frac{\sqrt[3]{t}}{z}}\right) - \frac{\log 1}{t}\]
    13. Applied times-frac7.0

      \[\leadsto \left(x - \color{blue}{\frac{1}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{1}} \cdot \frac{y}{\frac{\sqrt[3]{t}}{z}}}\right) - \frac{\log 1}{t}\]
    14. Simplified7.0

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

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

Reproduce

herbie shell --seed 2019174 
(FPCore (x y z t)
  :name "System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2"

  :herbie-target
  (if (< z -2.8874623088207947e+119) (- (- x (/ (/ (- 0.5) (* y t)) (* z z))) (* (/ (- 0.5) (* y t)) (/ (/ 2.0 z) (* z z)))) (- x (/ (log (+ 1.0 (* z y))) t)))

  (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))