Average Error: 24.6 → 8.6
Time: 7.4min
Precision: binary64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1608.94408824502466:\\ \;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right)\right)}{t}\\ \mathbf{elif}\;z \le -1.1872354773046371 \cdot 10^{-52}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{\frac{t}{\left(z \cdot y\right) \cdot \left(0.5 \cdot z + 1\right) + \log 1}}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;z \le -1608.94408824502466:\\
\;\;\;\;x - \frac{\log \left(\left(1 - y\right) + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot e^{z}\right)\right)}{t}\\

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

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (x - (((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 <= -1608.9440882450247)) {
		VAR = ((double) (x - (((double) log(((double) (((double) (1.0 - y)) + ((double) (((double) (((double) cbrt(y)) * ((double) cbrt(y)))) * ((double) (((double) cbrt(y)) * ((double) exp(z)))))))))) / t)));
	} else {
		double VAR_1;
		if ((z <= -1.1872354773046371e-52)) {
			VAR_1 = ((double) (x - (((double) log(((double) (1.0 + ((double) (y * ((double) (((double) (0.5 * ((double) pow(z, 2.0)))) + z)))))))) / t)));
		} else {
			VAR_1 = ((double) (x - (1.0 / (t / ((double) (((double) (((double) (z * y)) * ((double) (((double) (0.5 * z)) + 1.0)))) + ((double) log(1.0))))))));
		}
		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.6
Target15.9
Herbie8.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 3 regimes
  2. if z < -1608.94408824502466

    1. Initial program 11.2

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

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

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

    if -1608.94408824502466 < z < -1.1872354773046371e-52

    1. Initial program 27.6

      \[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}\]

    if -1.1872354773046371e-52 < z

    1. Initial program 30.6

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

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

      \[\leadsto x - \frac{\color{blue}{\left(z \cdot y\right) \cdot \left(0.5 \cdot z + 1\right) + \log 1}}{t}\]
    4. Using strategy rm
    5. Applied clear-num7.0

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

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

Reproduce

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