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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r300269 = x;
        double r300270 = 1.0;
        double r300271 = y;
        double r300272 = r300270 - r300271;
        double r300273 = z;
        double r300274 = exp(r300273);
        double r300275 = r300271 * r300274;
        double r300276 = r300272 + r300275;
        double r300277 = log(r300276);
        double r300278 = t;
        double r300279 = r300277 / r300278;
        double r300280 = r300269 - r300279;
        return r300280;
}

double f(double x, double y, double z, double t) {
        double r300281 = 1.0;
        double r300282 = y;
        double r300283 = r300281 - r300282;
        double r300284 = z;
        double r300285 = exp(r300284);
        double r300286 = r300282 * r300285;
        double r300287 = r300283 + r300286;
        double r300288 = 0.0;
        bool r300289 = r300287 <= r300288;
        double r300290 = x;
        double r300291 = 0.5;
        double r300292 = 2.0;
        double r300293 = pow(r300284, r300292);
        double r300294 = r300291 * r300293;
        double r300295 = r300294 + r300284;
        double r300296 = r300282 * r300295;
        double r300297 = r300281 + r300296;
        double r300298 = log(r300297);
        double r300299 = t;
        double r300300 = r300298 / r300299;
        double r300301 = r300290 - r300300;
        bool r300302 = r300287 <= r300281;
        double r300303 = r300282 / r300299;
        double r300304 = r300284 * r300303;
        double r300305 = r300281 * r300304;
        double r300306 = log(r300281);
        double r300307 = r300306 / r300299;
        double r300308 = r300305 + r300307;
        double r300309 = r300290 - r300308;
        double r300310 = cbrt(r300287);
        double r300311 = log(r300310);
        double r300312 = r300292 * r300311;
        double r300313 = r300312 + r300311;
        double r300314 = r300313 / r300299;
        double r300315 = r300290 - r300314;
        double r300316 = r300302 ? r300309 : r300315;
        double r300317 = r300289 ? r300301 : r300316;
        return r300317;
}

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.9
Target16.2
Herbie9.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 3 regimes
  2. if (+ (- 1.0 y) (* y (exp z))) < 0.0

    1. Initial program 64.0

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
    2. Taylor expanded around 0 13.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. Simplified13.7

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

    if 0.0 < (+ (- 1.0 y) (* y (exp z))) < 1.0

    1. Initial program 12.3

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

      \[\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. Simplified16.5

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

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

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

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

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

    if 1.0 < (+ (- 1.0 y) (* y (exp z)))

    1. Initial program 3.4

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

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

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

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

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

Reproduce

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