Average Error: 25.2 → 8.8
Time: 13.9s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.4146449611191369 \cdot 10^{-4}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right)\right)}{t}\\ \mathbf{elif}\;z \le 1.9140204121911595 \cdot 10^{-124}:\\ \;\;\;\;x - \left(1 \cdot \left(\left(z \cdot y\right) \cdot \frac{1}{t}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \mathbf{elif}\;z \le 1.4286153485566265 \cdot 10^{-8}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(\sqrt[3]{\left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right) + \left(1 \cdot \left(z \cdot y\right)\right) \cdot {\left(\sqrt[3]{\frac{1}{t}}\right)}^{3}} \cdot \sqrt[3]{\left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right) + \left(1 \cdot \left(z \cdot y\right)\right) \cdot {\left(\sqrt[3]{\frac{1}{t}}\right)}^{3}}\right) \cdot \sqrt[3]{\left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right) + \left(1 \cdot \left(z \cdot y\right)\right) \cdot {\left(\sqrt[3]{\frac{1}{t}}\right)}^{3}}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;z \le -2.4146449611191369 \cdot 10^{-4}:\\
\;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right)\right)}{t}\\

\mathbf{elif}\;z \le 1.9140204121911595 \cdot 10^{-124}:\\
\;\;\;\;x - \left(1 \cdot \left(\left(z \cdot y\right) \cdot \frac{1}{t}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\

\mathbf{elif}\;z \le 1.4286153485566265 \cdot 10^{-8}:\\
\;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r326782 = x;
        double r326783 = 1.0;
        double r326784 = y;
        double r326785 = r326783 - r326784;
        double r326786 = z;
        double r326787 = exp(r326786);
        double r326788 = r326784 * r326787;
        double r326789 = r326785 + r326788;
        double r326790 = log(r326789);
        double r326791 = t;
        double r326792 = r326790 / r326791;
        double r326793 = r326782 - r326792;
        return r326793;
}

double f(double x, double y, double z, double t) {
        double r326794 = z;
        double r326795 = -0.0002414644961119137;
        bool r326796 = r326794 <= r326795;
        double r326797 = x;
        double r326798 = 1.0;
        double r326799 = y;
        double r326800 = r326798 - r326799;
        double r326801 = cbrt(r326799);
        double r326802 = r326801 * r326801;
        double r326803 = exp(r326794);
        double r326804 = r326801 * r326803;
        double r326805 = r326802 * r326804;
        double r326806 = r326800 + r326805;
        double r326807 = log(r326806);
        double r326808 = t;
        double r326809 = r326807 / r326808;
        double r326810 = r326797 - r326809;
        double r326811 = 1.9140204121911595e-124;
        bool r326812 = r326794 <= r326811;
        double r326813 = r326794 * r326799;
        double r326814 = 1.0;
        double r326815 = r326814 / r326808;
        double r326816 = r326813 * r326815;
        double r326817 = r326798 * r326816;
        double r326818 = log(r326798);
        double r326819 = r326818 / r326808;
        double r326820 = 0.5;
        double r326821 = 2.0;
        double r326822 = pow(r326794, r326821);
        double r326823 = r326822 * r326799;
        double r326824 = r326823 / r326808;
        double r326825 = r326820 * r326824;
        double r326826 = r326819 + r326825;
        double r326827 = r326817 + r326826;
        double r326828 = r326797 - r326827;
        double r326829 = 1.4286153485566265e-08;
        bool r326830 = r326794 <= r326829;
        double r326831 = 0.5;
        double r326832 = r326831 * r326822;
        double r326833 = r326832 + r326794;
        double r326834 = r326799 * r326833;
        double r326835 = r326798 + r326834;
        double r326836 = log(r326835);
        double r326837 = r326836 / r326808;
        double r326838 = r326797 - r326837;
        double r326839 = r326798 * r326813;
        double r326840 = cbrt(r326815);
        double r326841 = 3.0;
        double r326842 = pow(r326840, r326841);
        double r326843 = r326839 * r326842;
        double r326844 = r326826 + r326843;
        double r326845 = cbrt(r326844);
        double r326846 = r326845 * r326845;
        double r326847 = r326846 * r326845;
        double r326848 = r326797 - r326847;
        double r326849 = r326830 ? r326838 : r326848;
        double r326850 = r326812 ? r326828 : r326849;
        double r326851 = r326796 ? r326810 : r326850;
        return r326851;
}

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.2
Herbie8.8
\[\begin{array}{l} \mathbf{if}\;z \lt -2.88746230882079466 \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 4 regimes
  2. if z < -0.0002414644961119137

    1. Initial program 11.6

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

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

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

    if -0.0002414644961119137 < z < 1.9140204121911595e-124

    1. Initial program 31.2

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

      \[\leadsto x - \color{blue}{\left(1 \cdot \frac{z \cdot y}{t} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)}\]
    3. Using strategy rm
    4. Applied div-inv6.5

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

    if 1.9140204121911595e-124 < z < 1.4286153485566265e-08

    1. Initial program 31.2

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

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

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

    if 1.4286153485566265e-08 < z

    1. Initial program 26.6

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

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

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

      \[\leadsto x - \left(1 \cdot \left(\left(z \cdot y\right) \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{1}{t}} \cdot \sqrt[3]{\frac{1}{t}}\right) \cdot \sqrt[3]{\frac{1}{t}}\right)}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\]
    7. Applied associate-*r*18.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.4146449611191369 \cdot 10^{-4}:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right)\right)}{t}\\ \mathbf{elif}\;z \le 1.9140204121911595 \cdot 10^{-124}:\\ \;\;\;\;x - \left(1 \cdot \left(\left(z \cdot y\right) \cdot \frac{1}{t}\right) + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \mathbf{elif}\;z \le 1.4286153485566265 \cdot 10^{-8}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(\sqrt[3]{\left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right) + \left(1 \cdot \left(z \cdot y\right)\right) \cdot {\left(\sqrt[3]{\frac{1}{t}}\right)}^{3}} \cdot \sqrt[3]{\left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right) + \left(1 \cdot \left(z \cdot y\right)\right) \cdot {\left(\sqrt[3]{\frac{1}{t}}\right)}^{3}}\right) \cdot \sqrt[3]{\left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right) + \left(1 \cdot \left(z \cdot y\right)\right) \cdot {\left(\sqrt[3]{\frac{1}{t}}\right)}^{3}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020042 
(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.8874623088207947e+119) (- (- 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)))