Average Error: 25.3 → 8.9
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 -138694822893.636077880859375:\\ \;\;\;\;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.091524081818618153101011307479821411096 \cdot 10^{-107}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{elif}\;z \le 9.714808507513085420960447880766659371435 \cdot 10^{-65}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\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 -138694822893.636077880859375:\\
\;\;\;\;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.091524081818618153101011307479821411096 \cdot 10^{-107}:\\
\;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r261301 = x;
        double r261302 = 1.0;
        double r261303 = y;
        double r261304 = r261302 - r261303;
        double r261305 = z;
        double r261306 = exp(r261305);
        double r261307 = r261303 * r261306;
        double r261308 = r261304 + r261307;
        double r261309 = log(r261308);
        double r261310 = t;
        double r261311 = r261309 / r261310;
        double r261312 = r261301 - r261311;
        return r261312;
}

double f(double x, double y, double z, double t) {
        double r261313 = z;
        double r261314 = -138694822893.63608;
        bool r261315 = r261313 <= r261314;
        double r261316 = x;
        double r261317 = 1.0;
        double r261318 = y;
        double r261319 = r261317 - r261318;
        double r261320 = exp(r261313);
        double r261321 = r261318 * r261320;
        double r261322 = cbrt(r261321);
        double r261323 = r261322 * r261322;
        double r261324 = r261323 * r261322;
        double r261325 = r261319 + r261324;
        double r261326 = log(r261325);
        double r261327 = t;
        double r261328 = r261326 / r261327;
        double r261329 = r261316 - r261328;
        double r261330 = -1.0915240818186182e-107;
        bool r261331 = r261313 <= r261330;
        double r261332 = 0.5;
        double r261333 = 2.0;
        double r261334 = pow(r261313, r261333);
        double r261335 = r261332 * r261334;
        double r261336 = r261335 + r261313;
        double r261337 = r261318 * r261336;
        double r261338 = r261317 + r261337;
        double r261339 = log(r261338);
        double r261340 = r261339 / r261327;
        double r261341 = r261316 - r261340;
        double r261342 = 9.714808507513085e-65;
        bool r261343 = r261313 <= r261342;
        double r261344 = r261313 * r261318;
        double r261345 = r261344 / r261327;
        double r261346 = r261317 * r261345;
        double r261347 = 0.5;
        double r261348 = r261334 * r261318;
        double r261349 = r261348 / r261327;
        double r261350 = r261347 * r261349;
        double r261351 = r261346 + r261350;
        double r261352 = r261316 - r261351;
        double r261353 = r261343 ? r261352 : r261341;
        double r261354 = r261331 ? r261341 : r261353;
        double r261355 = r261315 ? r261329 : r261354;
        return r261355;
}

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.2
Herbie8.9
\[\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 < -138694822893.63608

    1. Initial program 11.5

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

      \[\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 -138694822893.63608 < z < -1.0915240818186182e-107 or 9.714808507513085e-65 < z

    1. Initial program 28.3

      \[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. Simplified14.1

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

    if -1.0915240818186182e-107 < z < 9.714808507513085e-65

    1. Initial program 31.6

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

      \[\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 associate-/l*7.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -138694822893.636077880859375:\\ \;\;\;\;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.091524081818618153101011307479821411096 \cdot 10^{-107}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{elif}\;z \le 9.714808507513085420960447880766659371435 \cdot 10^{-65}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \end{array}\]

Reproduce

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