Average Error: 25.2 → 8.9
Time: 25.3s
Precision: 64
\[x - \frac{\log \left(\left(1.0 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -0.005019481635896301:\\ \;\;\;\;x - \log \left(e^{z} \cdot y + \left(1.0 - y\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1.0 \cdot \left(\left(\sqrt[3]{y} \cdot \left(z \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{y}}{t}\right) + \frac{\log 1.0}{t}\right)\\ \end{array}\]
x - \frac{\log \left(\left(1.0 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;z \le -0.005019481635896301:\\
\;\;\;\;x - \log \left(e^{z} \cdot y + \left(1.0 - y\right)\right) \cdot \frac{1}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r9875887 = x;
        double r9875888 = 1.0;
        double r9875889 = y;
        double r9875890 = r9875888 - r9875889;
        double r9875891 = z;
        double r9875892 = exp(r9875891);
        double r9875893 = r9875889 * r9875892;
        double r9875894 = r9875890 + r9875893;
        double r9875895 = log(r9875894);
        double r9875896 = t;
        double r9875897 = r9875895 / r9875896;
        double r9875898 = r9875887 - r9875897;
        return r9875898;
}

double f(double x, double y, double z, double t) {
        double r9875899 = z;
        double r9875900 = -0.005019481635896301;
        bool r9875901 = r9875899 <= r9875900;
        double r9875902 = x;
        double r9875903 = exp(r9875899);
        double r9875904 = y;
        double r9875905 = r9875903 * r9875904;
        double r9875906 = 1.0;
        double r9875907 = r9875906 - r9875904;
        double r9875908 = r9875905 + r9875907;
        double r9875909 = log(r9875908);
        double r9875910 = 1.0;
        double r9875911 = t;
        double r9875912 = r9875910 / r9875911;
        double r9875913 = r9875909 * r9875912;
        double r9875914 = r9875902 - r9875913;
        double r9875915 = cbrt(r9875904);
        double r9875916 = r9875899 * r9875915;
        double r9875917 = r9875915 * r9875916;
        double r9875918 = r9875915 / r9875911;
        double r9875919 = r9875917 * r9875918;
        double r9875920 = r9875906 * r9875919;
        double r9875921 = log(r9875906);
        double r9875922 = r9875921 / r9875911;
        double r9875923 = r9875920 + r9875922;
        double r9875924 = r9875902 - r9875923;
        double r9875925 = r9875901 ? r9875914 : r9875924;
        return r9875925;
}

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.6
Herbie8.9
\[\begin{array}{l} \mathbf{if}\;z \lt -2.8874623088207947 \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.0}{z}}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1.0 + z \cdot y\right)}{t}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -0.005019481635896301

    1. Initial program 11.7

      \[x - \frac{\log \left(\left(1.0 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Using strategy rm
    3. Applied div-inv11.7

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

    if -0.005019481635896301 < z

    1. Initial program 31.0

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

      \[\leadsto \color{blue}{x - \left(1.0 \cdot \frac{z \cdot y}{t} + \frac{\log 1.0}{t}\right)}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity7.2

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

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

      \[\leadsto x - \left(1.0 \cdot \left(\color{blue}{z} \cdot \frac{y}{t}\right) + \frac{\log 1.0}{t}\right)\]
    7. Using strategy rm
    8. Applied *-un-lft-identity9.1

      \[\leadsto x - \left(1.0 \cdot \left(z \cdot \frac{y}{\color{blue}{1 \cdot t}}\right) + \frac{\log 1.0}{t}\right)\]
    9. Applied add-cube-cbrt9.3

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

      \[\leadsto x - \left(1.0 \cdot \left(z \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1} \cdot \frac{\sqrt[3]{y}}{t}\right)}\right) + \frac{\log 1.0}{t}\right)\]
    11. Applied associate-*r*7.7

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

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

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

Reproduce

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