Average Error: 23.4 → 5.6
Time: 6.5s
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.998561252881359329:\\ \;\;\;\;x - \frac{\log \left(1 - \left(1 - e^{z}\right) \cdot y\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \frac{z \cdot y}{t} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\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.998561252881359329:\\
\;\;\;\;x - \frac{\log \left(1 - \left(1 - e^{z}\right) \cdot y\right)}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r194480 = x;
        double r194481 = 1.0;
        double r194482 = y;
        double r194483 = r194481 - r194482;
        double r194484 = z;
        double r194485 = exp(r194484);
        double r194486 = r194482 * r194485;
        double r194487 = r194483 + r194486;
        double r194488 = log(r194487);
        double r194489 = t;
        double r194490 = r194488 / r194489;
        double r194491 = r194480 - r194490;
        return r194491;
}

double f(double x, double y, double z, double t) {
        double r194492 = z;
        double r194493 = exp(r194492);
        double r194494 = 0.9985612528813593;
        bool r194495 = r194493 <= r194494;
        double r194496 = x;
        double r194497 = 1.0;
        double r194498 = 1.0;
        double r194499 = r194498 - r194493;
        double r194500 = y;
        double r194501 = r194499 * r194500;
        double r194502 = r194497 - r194501;
        double r194503 = log(r194502);
        double r194504 = t;
        double r194505 = r194503 / r194504;
        double r194506 = r194496 - r194505;
        double r194507 = r194492 * r194500;
        double r194508 = r194507 / r194504;
        double r194509 = r194497 * r194508;
        double r194510 = log(r194497);
        double r194511 = r194510 / r194504;
        double r194512 = 0.5;
        double r194513 = 2.0;
        double r194514 = pow(r194492, r194513);
        double r194515 = r194514 * r194500;
        double r194516 = r194515 / r194504;
        double r194517 = r194512 * r194516;
        double r194518 = r194511 + r194517;
        double r194519 = r194509 + r194518;
        double r194520 = r194496 - r194519;
        double r194521 = r194495 ? r194506 : r194520;
        return r194521;
}

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

Original23.4
Target13.5
Herbie5.6
\[\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 2 regimes
  2. if (exp z) < 0.9985612528813593

    1. Initial program 0.7

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

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

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

    if 0.9985612528813593 < (exp z)

    1. Initial program 30.5

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

      \[\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. Recombined 2 regimes into one program.
  4. Final simplification5.6

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

Reproduce

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