Average Error: 25.0 → 8.4
Time: 23.0s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.244788512059007119082651539667239777199 \cdot 10^{-16}:\\ \;\;\;\;x - \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)}}{\frac{t}{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}}\\ \mathbf{elif}\;z \le 9.324139649158486162460900502257892519494 \cdot 10^{-135}:\\ \;\;\;\;x - \left(1 \cdot \frac{\frac{\frac{y}{\sqrt[3]{\frac{t}{z}}}}{\sqrt[3]{\frac{t}{z}}}}{\sqrt[3]{\frac{t}{z}}} + \frac{0.5}{\frac{t}{\left(y \cdot z\right) \cdot z}}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(\left(1 + y \cdot z\right) + \frac{1}{2} \cdot \left(y \cdot \left(z \cdot z\right)\right)\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 -3.244788512059007119082651539667239777199 \cdot 10^{-16}:\\
\;\;\;\;x - \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)}}{\frac{t}{\sqrt[3]{\log \left(\left(1 + y \cdot e^{z}\right) - y\right)}}}\\

\mathbf{elif}\;z \le 9.324139649158486162460900502257892519494 \cdot 10^{-135}:\\
\;\;\;\;x - \left(1 \cdot \frac{\frac{\frac{y}{\sqrt[3]{\frac{t}{z}}}}{\sqrt[3]{\frac{t}{z}}}}{\sqrt[3]{\frac{t}{z}}} + \frac{0.5}{\frac{t}{\left(y \cdot z\right) \cdot z}}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r238580 = x;
        double r238581 = 1.0;
        double r238582 = y;
        double r238583 = r238581 - r238582;
        double r238584 = z;
        double r238585 = exp(r238584);
        double r238586 = r238582 * r238585;
        double r238587 = r238583 + r238586;
        double r238588 = log(r238587);
        double r238589 = t;
        double r238590 = r238588 / r238589;
        double r238591 = r238580 - r238590;
        return r238591;
}

double f(double x, double y, double z, double t) {
        double r238592 = z;
        double r238593 = -3.244788512059007e-16;
        bool r238594 = r238592 <= r238593;
        double r238595 = x;
        double r238596 = 1.0;
        double r238597 = y;
        double r238598 = r238596 - r238597;
        double r238599 = exp(r238592);
        double r238600 = r238597 * r238599;
        double r238601 = r238598 + r238600;
        double r238602 = log(r238601);
        double r238603 = cbrt(r238602);
        double r238604 = r238603 * r238603;
        double r238605 = t;
        double r238606 = r238596 + r238600;
        double r238607 = r238606 - r238597;
        double r238608 = log(r238607);
        double r238609 = cbrt(r238608);
        double r238610 = r238605 / r238609;
        double r238611 = r238604 / r238610;
        double r238612 = r238595 - r238611;
        double r238613 = 9.324139649158486e-135;
        bool r238614 = r238592 <= r238613;
        double r238615 = r238605 / r238592;
        double r238616 = cbrt(r238615);
        double r238617 = r238597 / r238616;
        double r238618 = r238617 / r238616;
        double r238619 = r238618 / r238616;
        double r238620 = r238596 * r238619;
        double r238621 = 0.5;
        double r238622 = r238597 * r238592;
        double r238623 = r238622 * r238592;
        double r238624 = r238605 / r238623;
        double r238625 = r238621 / r238624;
        double r238626 = r238620 + r238625;
        double r238627 = r238595 - r238626;
        double r238628 = r238596 + r238622;
        double r238629 = 0.5;
        double r238630 = r238592 * r238592;
        double r238631 = r238597 * r238630;
        double r238632 = r238629 * r238631;
        double r238633 = r238628 + r238632;
        double r238634 = log(r238633);
        double r238635 = r238634 / r238605;
        double r238636 = r238595 - r238635;
        double r238637 = r238614 ? r238627 : r238636;
        double r238638 = r238594 ? r238612 : r238637;
        return r238638;
}

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.0
Target16.2
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 < -3.244788512059007e-16

    1. Initial program 12.0

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

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

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

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

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

    if -3.244788512059007e-16 < z < 9.324139649158486e-135

    1. Initial program 31.4

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Simplified31.4

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

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

      \[\leadsto x - \color{blue}{\left(\frac{z \cdot z}{\frac{t}{y}} \cdot 0.5 + \left(\frac{\log 1}{t} + \frac{z \cdot 1}{\frac{t}{y}}\right)\right)}\]
    5. Taylor expanded around inf 5.8

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

      \[\leadsto x - \color{blue}{\left(\frac{y}{\frac{t}{z}} \cdot 1 + \frac{0.5}{\frac{t}{\left(y \cdot z\right) \cdot z}}\right)}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt5.4

      \[\leadsto x - \left(\frac{y}{\color{blue}{\left(\sqrt[3]{\frac{t}{z}} \cdot \sqrt[3]{\frac{t}{z}}\right) \cdot \sqrt[3]{\frac{t}{z}}}} \cdot 1 + \frac{0.5}{\frac{t}{\left(y \cdot z\right) \cdot z}}\right)\]
    9. Applied associate-/r*5.4

      \[\leadsto x - \left(\color{blue}{\frac{\frac{y}{\sqrt[3]{\frac{t}{z}} \cdot \sqrt[3]{\frac{t}{z}}}}{\sqrt[3]{\frac{t}{z}}}} \cdot 1 + \frac{0.5}{\frac{t}{\left(y \cdot z\right) \cdot z}}\right)\]
    10. Simplified5.4

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

    if 9.324139649158486e-135 < z

    1. Initial program 29.4

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Simplified29.4

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

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

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

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

Reproduce

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