Average Error: 25.2 → 8.8
Time: 13.6s
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 e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\ \mathbf{elif}\;z \le 1.9140204121911595 \cdot 10^{-124}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\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 e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\

\mathbf{elif}\;z \le 1.9140204121911595 \cdot 10^{-124}:\\
\;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\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 r540281 = x;
        double r540282 = 1.0;
        double r540283 = y;
        double r540284 = r540282 - r540283;
        double r540285 = z;
        double r540286 = exp(r540285);
        double r540287 = r540283 * r540286;
        double r540288 = r540284 + r540287;
        double r540289 = log(r540288);
        double r540290 = t;
        double r540291 = r540289 / r540290;
        double r540292 = r540281 - r540291;
        return r540292;
}

double f(double x, double y, double z, double t) {
        double r540293 = z;
        double r540294 = -0.0002414644961119137;
        bool r540295 = r540293 <= r540294;
        double r540296 = x;
        double r540297 = 1.0;
        double r540298 = y;
        double r540299 = r540297 - r540298;
        double r540300 = exp(r540293);
        double r540301 = r540298 * r540300;
        double r540302 = cbrt(r540301);
        double r540303 = r540302 * r540302;
        double r540304 = r540303 * r540302;
        double r540305 = r540299 + r540304;
        double r540306 = log(r540305);
        double r540307 = t;
        double r540308 = r540306 / r540307;
        double r540309 = r540296 - r540308;
        double r540310 = 1.9140204121911595e-124;
        bool r540311 = r540293 <= r540310;
        double r540312 = r540293 * r540298;
        double r540313 = r540312 / r540307;
        double r540314 = r540297 * r540313;
        double r540315 = 0.5;
        double r540316 = 2.0;
        double r540317 = pow(r540293, r540316);
        double r540318 = r540317 * r540298;
        double r540319 = r540318 / r540307;
        double r540320 = r540315 * r540319;
        double r540321 = r540314 + r540320;
        double r540322 = r540296 - r540321;
        double r540323 = 1.4286153485566265e-08;
        bool r540324 = r540293 <= r540323;
        double r540325 = 0.5;
        double r540326 = r540325 * r540317;
        double r540327 = r540326 + r540293;
        double r540328 = r540298 * r540327;
        double r540329 = r540297 + r540328;
        double r540330 = log(r540329);
        double r540331 = r540330 / r540307;
        double r540332 = r540296 - r540331;
        double r540333 = log(r540297);
        double r540334 = r540333 / r540307;
        double r540335 = r540334 + r540320;
        double r540336 = r540297 * r540312;
        double r540337 = 1.0;
        double r540338 = r540337 / r540307;
        double r540339 = cbrt(r540338);
        double r540340 = 3.0;
        double r540341 = pow(r540339, r540340);
        double r540342 = r540336 * r540341;
        double r540343 = r540335 + r540342;
        double r540344 = cbrt(r540343);
        double r540345 = r540344 * r540344;
        double r540346 = r540345 * r540344;
        double r540347 = r540296 - r540346;
        double r540348 = r540324 ? r540332 : r540347;
        double r540349 = r540311 ? r540322 : r540348;
        double r540350 = r540295 ? r540309 : r540349;
        return r540350;
}

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(\sqrt[3]{y \cdot e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}}\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)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt6.6

      \[\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*6.6

      \[\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. Taylor expanded around inf 6.5

      \[\leadsto x - \color{blue}{\left(1 \cdot \frac{z \cdot y}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\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 e^{z}} \cdot \sqrt[3]{y \cdot e^{z}}\right) \cdot \sqrt[3]{y \cdot e^{z}}\right)}{t}\\ \mathbf{elif}\;z \le 1.9140204121911595 \cdot 10^{-124}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\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)))