Average Error: 24.7 → 9.6
Time: 6.3s
Precision: 64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} = -\infty:\\ \;\;\;\;x - \left(1 \cdot \left(\frac{z}{t} \cdot y\right) + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -1.46432279035300478 \cdot 10^{-124}:\\ \;\;\;\;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}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 2.2345576967229745 \cdot 10^{-140}:\\ \;\;\;\;x - \left(1 \cdot \left(z \cdot \frac{y}{t}\right) + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 1.91498230609953577 \cdot 10^{302}:\\ \;\;\;\;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}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + \left({z}^{2} \cdot \left(\frac{1}{2} + z \cdot \frac{1}{6}\right) + z\right) \cdot y\right)}{t}\\ \end{array}\]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\begin{array}{l}
\mathbf{if}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} = -\infty:\\
\;\;\;\;x - \left(1 \cdot \left(\frac{z}{t} \cdot y\right) + \frac{\log 1}{t}\right)\\

\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -1.46432279035300478 \cdot 10^{-124}:\\
\;\;\;\;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}\\

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

\mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 1.91498230609953577 \cdot 10^{302}:\\
\;\;\;\;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}\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return (x - (log(((1.0 - y) + (y * exp(z)))) / t));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= -inf.0)) {
		VAR = (x - ((1.0 * ((z / t) * y)) + (log(1.0) / t)));
	} else {
		double VAR_1;
		if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= -1.4643227903530048e-124)) {
			VAR_1 = (x - (((2.0 * log(cbrt(((1.0 - y) + (y * exp(z)))))) + log(cbrt(((1.0 - y) + (y * exp(z)))))) / t));
		} else {
			double VAR_2;
			if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= 2.2345576967229745e-140)) {
				VAR_2 = (x - ((1.0 * (z * (y / t))) + (log(1.0) / t)));
			} else {
				double VAR_3;
				if (((x - (log(((1.0 - y) + (y * exp(z)))) / t)) <= 1.9149823060995358e+302)) {
					VAR_3 = (x - (((2.0 * log(cbrt(((1.0 - y) + (y * exp(z)))))) + log(cbrt(((1.0 - y) + (y * exp(z)))))) / t));
				} else {
					VAR_3 = (x - (log((1.0 + (((pow(z, 2.0) * (0.5 + (z * 0.16666666666666666))) + z) * y))) / t));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		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.7
Target15.9
Herbie9.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 4 regimes
  2. if (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < -inf.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 14.1

      \[\leadsto \color{blue}{x - \left(1 \cdot \frac{z \cdot y}{t} + \frac{\log 1}{t}\right)}\]
    3. Using strategy rm
    4. Applied associate-/l*22.1

      \[\leadsto x - \left(1 \cdot \color{blue}{\frac{z}{\frac{t}{y}}} + \frac{\log 1}{t}\right)\]
    5. Using strategy rm
    6. Applied associate-/r/14.7

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

    if -inf.0 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < -1.4643227903530048e-124 or 2.2345576967229745e-140 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < 1.9149823060995358e+302

    1. Initial program 5.3

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

      \[\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-prod5.2

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

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

    if -1.4643227903530048e-124 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)) < 2.2345576967229745e-140

    1. Initial program 25.6

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

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

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

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

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

    if 1.9149823060995358e+302 < (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t))

    1. Initial program 62.7

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} = -\infty:\\ \;\;\;\;x - \left(1 \cdot \left(\frac{z}{t} \cdot y\right) + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le -1.46432279035300478 \cdot 10^{-124}:\\ \;\;\;\;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}\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 2.2345576967229745 \cdot 10^{-140}:\\ \;\;\;\;x - \left(1 \cdot \left(z \cdot \frac{y}{t}\right) + \frac{\log 1}{t}\right)\\ \mathbf{elif}\;x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \le 1.91498230609953577 \cdot 10^{302}:\\ \;\;\;\;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}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + \left({z}^{2} \cdot \left(\frac{1}{2} + z \cdot \frac{1}{6}\right) + z\right) \cdot y\right)}{t}\\ \end{array}\]

Reproduce

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