Average Error: 24.4 → 8.3
Time: 7.8s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -0.0015621185568995256:\\ \;\;\;\;x - \sqrt{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)} \cdot \frac{\sqrt{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}{t}\\ \mathbf{elif}\;z \le 5.03284933011189963 \cdot 10^{-80}:\\ \;\;\;\;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(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 -0.0015621185568995256:\\
\;\;\;\;x - \sqrt{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)} \cdot \frac{\sqrt{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}{t}\\

\mathbf{elif}\;z \le 5.03284933011189963 \cdot 10^{-80}:\\
\;\;\;\;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(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 r383242 = x;
        double r383243 = 1.0;
        double r383244 = y;
        double r383245 = r383243 - r383244;
        double r383246 = z;
        double r383247 = exp(r383246);
        double r383248 = r383244 * r383247;
        double r383249 = r383245 + r383248;
        double r383250 = log(r383249);
        double r383251 = t;
        double r383252 = r383250 / r383251;
        double r383253 = r383242 - r383252;
        return r383253;
}

double f(double x, double y, double z, double t) {
        double r383254 = z;
        double r383255 = -0.0015621185568995256;
        bool r383256 = r383254 <= r383255;
        double r383257 = x;
        double r383258 = 1.0;
        double r383259 = y;
        double r383260 = r383258 - r383259;
        double r383261 = exp(r383254);
        double r383262 = r383259 * r383261;
        double r383263 = r383260 + r383262;
        double r383264 = log(r383263);
        double r383265 = sqrt(r383264);
        double r383266 = t;
        double r383267 = r383265 / r383266;
        double r383268 = r383265 * r383267;
        double r383269 = r383257 - r383268;
        double r383270 = 5.0328493301119e-80;
        bool r383271 = r383254 <= r383270;
        double r383272 = cbrt(r383266);
        double r383273 = r383272 * r383272;
        double r383274 = r383254 / r383273;
        double r383275 = r383259 / r383272;
        double r383276 = r383274 * r383275;
        double r383277 = r383258 * r383276;
        double r383278 = log(r383258);
        double r383279 = r383278 / r383266;
        double r383280 = r383277 + r383279;
        double r383281 = r383257 - r383280;
        double r383282 = 0.5;
        double r383283 = 2.0;
        double r383284 = pow(r383254, r383283);
        double r383285 = r383282 * r383284;
        double r383286 = r383285 + r383254;
        double r383287 = r383259 * r383286;
        double r383288 = r383258 + r383287;
        double r383289 = log(r383288);
        double r383290 = r383289 / r383266;
        double r383291 = r383257 - r383290;
        double r383292 = r383271 ? r383281 : r383291;
        double r383293 = r383256 ? r383269 : r383292;
        return r383293;
}

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.4
Target16.3
Herbie8.3
\[\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 z < -0.0015621185568995256

    1. Initial program 11.4

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

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

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

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

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

    if -0.0015621185568995256 < z < 5.0328493301119e-80

    1. Initial program 30.0

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

      \[\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. Simplified5.8

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

      \[\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.0

      \[\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-frac5.6

      \[\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 5.0328493301119e-80 < z

    1. Initial program 29.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -0.0015621185568995256:\\ \;\;\;\;x - \sqrt{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)} \cdot \frac{\sqrt{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}}{t}\\ \mathbf{elif}\;z \le 5.03284933011189963 \cdot 10^{-80}:\\ \;\;\;\;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(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \end{array}\]

Reproduce

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