Average Error: 25.3 → 8.5
Time: 19.4s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1996524655068977.75:\\ \;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}\\ \mathbf{elif}\;z \le 8.257479803818375788788539194002137756388 \cdot 10^{-61}:\\ \;\;\;\;x - \left(1 \cdot \left(\frac{z}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{y}{\sqrt[3]{t}}\right) + \frac{\log 1}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(\frac{1}{2} \cdot \left({z}^{2} \cdot y\right) + \left(z \cdot y + 1\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 -1996524655068977.75:\\
\;\;\;\;x - \frac{1}{\frac{t}{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r196326 = x;
        double r196327 = 1.0;
        double r196328 = y;
        double r196329 = r196327 - r196328;
        double r196330 = z;
        double r196331 = exp(r196330);
        double r196332 = r196328 * r196331;
        double r196333 = r196329 + r196332;
        double r196334 = log(r196333);
        double r196335 = t;
        double r196336 = r196334 / r196335;
        double r196337 = r196326 - r196336;
        return r196337;
}

double f(double x, double y, double z, double t) {
        double r196338 = z;
        double r196339 = -1996524655068977.8;
        bool r196340 = r196338 <= r196339;
        double r196341 = x;
        double r196342 = 1.0;
        double r196343 = t;
        double r196344 = 1.0;
        double r196345 = y;
        double r196346 = r196344 - r196345;
        double r196347 = exp(r196338);
        double r196348 = r196345 * r196347;
        double r196349 = r196346 + r196348;
        double r196350 = log(r196349);
        double r196351 = r196343 / r196350;
        double r196352 = r196342 / r196351;
        double r196353 = r196341 - r196352;
        double r196354 = 8.257479803818376e-61;
        bool r196355 = r196338 <= r196354;
        double r196356 = cbrt(r196343);
        double r196357 = r196356 * r196356;
        double r196358 = r196338 / r196357;
        double r196359 = r196345 / r196356;
        double r196360 = r196358 * r196359;
        double r196361 = r196344 * r196360;
        double r196362 = log(r196344);
        double r196363 = r196362 / r196343;
        double r196364 = r196361 + r196363;
        double r196365 = r196341 - r196364;
        double r196366 = 0.5;
        double r196367 = 2.0;
        double r196368 = pow(r196338, r196367);
        double r196369 = r196368 * r196345;
        double r196370 = r196366 * r196369;
        double r196371 = r196338 * r196345;
        double r196372 = r196371 + r196344;
        double r196373 = r196370 + r196372;
        double r196374 = log(r196373);
        double r196375 = r196374 / r196343;
        double r196376 = r196341 - r196375;
        double r196377 = r196355 ? r196365 : r196376;
        double r196378 = r196340 ? r196353 : r196377;
        return r196378;
}

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.3
Target16.4
Herbie8.5
\[\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 < -1996524655068977.8

    1. Initial program 12.1

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

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

    if -1996524655068977.8 < z < 8.257479803818376e-61

    1. Initial program 30.5

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

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

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

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

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

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

    if 8.257479803818376e-61 < z

    1. Initial program 29.8

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

      \[\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. Recombined 3 regimes into one program.
  4. Final simplification8.5

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

Reproduce

herbie shell --seed 2019208 
(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.88746230882079466e119) (- (- 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)))