Average Error: 24.9 → 7.7
Time: 11.3s
Precision: binary64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -208.32873466379357:\\ \;\;\;\;x - \frac{\log \left(1 + \left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right) - y\right)\right)}{t}\\ \mathbf{elif}\;z \le -2.0391679135262321 \cdot 10^{-80}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(z + \left(z \cdot z\right) \cdot \left(z \cdot \frac{1}{6} + \frac{1}{2}\right)\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \left(y \cdot \frac{z}{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}\;z \le -208.32873466379357:\\
\;\;\;\;x - \frac{\log \left(1 + \left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right) - y\right)\right)}{t}\\

\mathbf{elif}\;z \le -2.0391679135262321 \cdot 10^{-80}:\\
\;\;\;\;x - \frac{\log \left(1 + y \cdot \left(z + \left(z \cdot z\right) \cdot \left(z \cdot \frac{1}{6} + \frac{1}{2}\right)\right)\right)}{t}\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (x - ((double) (((double) log(((double) (((double) (1.0 - y)) + ((double) (y * ((double) exp(z)))))))) / t))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((z <= -208.32873466379357)) {
		VAR = ((double) (x - ((double) (((double) log(((double) (1.0 + ((double) (((double) (((double) (((double) cbrt(y)) * ((double) cbrt(y)))) * ((double) (((double) cbrt(y)) * ((double) exp(z)))))) - y)))))) / t))));
	} else {
		double VAR_1;
		if ((z <= -2.039167913526232e-80)) {
			VAR_1 = ((double) (x - ((double) (((double) log(((double) (1.0 + ((double) (y * ((double) (z + ((double) (((double) (z * z)) * ((double) (((double) (z * 0.16666666666666666)) + 0.5)))))))))))) / t))));
		} else {
			VAR_1 = ((double) (x - ((double) (((double) (1.0 * ((double) (y * ((double) (z / t)))))) + ((double) (((double) log(1.0)) / t))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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
Herbie7.7
\[\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 < -208.32873466379357

    1. Initial program 10.6

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

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

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

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

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

    if -208.32873466379357 < z < -2.0391679135262321e-80

    1. Initial program 27.4

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

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

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

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

    if -2.0391679135262321e-80 < z

    1. Initial program 31.5

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020179 
(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 (/ (/ (neg 0.5) (* y t)) (* z z))) (* (/ (neg 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)))