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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r233321 = x;
        double r233322 = 1.0;
        double r233323 = y;
        double r233324 = r233322 - r233323;
        double r233325 = z;
        double r233326 = exp(r233325);
        double r233327 = r233323 * r233326;
        double r233328 = r233324 + r233327;
        double r233329 = log(r233328);
        double r233330 = t;
        double r233331 = r233329 / r233330;
        double r233332 = r233321 - r233331;
        return r233332;
}

double f(double x, double y, double z, double t) {
        double r233333 = z;
        double r233334 = exp(r233333);
        double r233335 = 0.9999999999999999;
        bool r233336 = r233334 <= r233335;
        double r233337 = x;
        double r233338 = 1.0;
        double r233339 = y;
        double r233340 = r233338 - r233339;
        double r233341 = r233339 * r233334;
        double r233342 = r233340 + r233341;
        double r233343 = log(r233342);
        double r233344 = 1.0;
        double r233345 = t;
        double r233346 = r233344 / r233345;
        double r233347 = r233343 * r233346;
        double r233348 = r233337 - r233347;
        double r233349 = cbrt(r233339);
        double r233350 = r233349 * r233349;
        double r233351 = cbrt(r233345);
        double r233352 = r233351 * r233351;
        double r233353 = r233350 / r233352;
        double r233354 = r233333 * r233353;
        double r233355 = r233349 / r233351;
        double r233356 = r233354 * r233355;
        double r233357 = r233338 * r233356;
        double r233358 = log(r233338);
        double r233359 = r233358 / r233345;
        double r233360 = r233357 + r233359;
        double r233361 = r233337 - r233360;
        double r233362 = r233336 ? r233348 : r233361;
        return r233362;
}

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.0
Target16.0
Herbie8.6
\[\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 2 regimes
  2. if (exp z) < 0.9999999999999999

    1. Initial program 12.3

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

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

    if 0.9999999999999999 < (exp z)

    1. Initial program 31.0

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

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

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

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

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

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

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

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

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

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

Reproduce

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