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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r226187 = x;
        double r226188 = 1.0;
        double r226189 = y;
        double r226190 = r226188 - r226189;
        double r226191 = z;
        double r226192 = exp(r226191);
        double r226193 = r226189 * r226192;
        double r226194 = r226190 + r226193;
        double r226195 = log(r226194);
        double r226196 = t;
        double r226197 = r226195 / r226196;
        double r226198 = r226187 - r226197;
        return r226198;
}

double f(double x, double y, double z, double t) {
        double r226199 = z;
        double r226200 = -3716868871.2444687;
        bool r226201 = r226199 <= r226200;
        double r226202 = x;
        double r226203 = 1.0;
        double r226204 = y;
        double r226205 = r226203 - r226204;
        double r226206 = exp(r226199);
        double r226207 = r226204 * r226206;
        double r226208 = 3.0;
        double r226209 = pow(r226207, r226208);
        double r226210 = cbrt(r226209);
        double r226211 = r226205 + r226210;
        double r226212 = log(r226211);
        double r226213 = t;
        double r226214 = r226212 / r226213;
        double r226215 = r226202 - r226214;
        double r226216 = log(r226203);
        double r226217 = r226216 / r226213;
        double r226218 = r226213 / r226203;
        double r226219 = r226199 / r226218;
        double r226220 = r226204 * r226219;
        double r226221 = r226217 + r226220;
        double r226222 = r226202 - r226221;
        double r226223 = r226201 ? r226215 : r226222;
        return r226223;
}

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

Original24.8
Target16.5
Herbie8.2
\[\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 z < -3716868871.2444687

    1. Initial program 11.4

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Simplified11.4

      \[\leadsto \color{blue}{x - \frac{\log \left(y \cdot e^{z} + \left(1 - y\right)\right)}{t}}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube11.4

      \[\leadsto x - \frac{\log \left(y \cdot \color{blue}{\sqrt[3]{\left(e^{z} \cdot e^{z}\right) \cdot e^{z}}} + \left(1 - y\right)\right)}{t}\]
    5. Applied add-cbrt-cube25.8

      \[\leadsto x - \frac{\log \left(\color{blue}{\sqrt[3]{\left(y \cdot y\right) \cdot y}} \cdot \sqrt[3]{\left(e^{z} \cdot e^{z}\right) \cdot e^{z}} + \left(1 - y\right)\right)}{t}\]
    6. Applied cbrt-unprod25.8

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

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

    if -3716868871.2444687 < z

    1. Initial program 30.3

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Simplified30.3

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

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

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

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

      \[\leadsto \color{blue}{x - \left(\frac{z \cdot 1}{\frac{t}{y}} + \frac{\log 1}{t}\right)}\]
    7. Using strategy rm
    8. Applied associate-/r/6.9

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

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

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

Reproduce

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