Average Error: 25.0 → 8.2
Time: 9.9s
Precision: binary64
\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.9819187612960195 \cdot 10^{-11}:\\ \;\;\;\;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.2038363056561298 \cdot 10^{-136}:\\ \;\;\;\;x - \left(1 \cdot \frac{\frac{z}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{y} \cdot \sqrt[3]{y}}}}{\frac{\sqrt[3]{t}}{\sqrt[3]{y}}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \mathbf{elif}\;z \le 7.2550510220773841 \cdot 10^{-34}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \frac{z}{\frac{t}{y}} + \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}\;z \le -9.9819187612960195 \cdot 10^{-11}:\\
\;\;\;\;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.2038363056561298 \cdot 10^{-136}:\\
\;\;\;\;x - \left(1 \cdot \frac{\frac{z}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{y} \cdot \sqrt[3]{y}}}}{\frac{\sqrt[3]{t}}{\sqrt[3]{y}}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;x - \left(1 \cdot \frac{z}{\frac{t}{y}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\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 <= -9.98191876129602e-11)) {
		VAR = ((double) (x - ((double) (((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.2038363056561298e-136)) {
			VAR_1 = ((double) (x - ((double) (((double) (1.0 * ((double) (((double) (z / ((double) (((double) (((double) cbrt(t)) * ((double) cbrt(t)))) / ((double) (((double) cbrt(y)) * ((double) cbrt(y)))))))) / ((double) (((double) cbrt(t)) / ((double) cbrt(y)))))))) + ((double) (((double) (((double) log(1.0)) / t)) + ((double) (0.5 * ((double) (((double) (((double) pow(z, 2.0)) * y)) / t))))))))));
		} else {
			double VAR_2;
			if ((z <= 7.255051022077384e-34)) {
				VAR_2 = ((double) (x - ((double) (((double) log(((double) (1.0 + ((double) (y * ((double) (((double) (0.5 * ((double) pow(z, 2.0)))) + z)))))))) / t))));
			} else {
				VAR_2 = ((double) (x - ((double) (((double) (1.0 * ((double) (z / ((double) (t / y)))))) + ((double) (((double) (((double) log(1.0)) / t)) + ((double) (0.5 * ((double) (((double) (((double) pow(z, 2.0)) * y)) / t))))))))));
			}
			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

Original25.0
Target16.4
Herbie8.2
\[\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 z < -9.9819187612960195e-11

    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 add-cube-cbrt11.4

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

      \[\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 -9.9819187612960195e-11 < z < 1.2038363056561298e-136

    1. Initial program 31.4

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

      \[\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. Using strategy rm
    4. Applied associate-/l*8.0

      \[\leadsto x - \left(1 \cdot \color{blue}{\frac{z}{\frac{t}{y}}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt8.2

      \[\leadsto x - \left(1 \cdot \frac{z}{\frac{t}{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\]
    7. Applied add-cube-cbrt8.2

      \[\leadsto x - \left(1 \cdot \frac{z}{\frac{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\]
    8. Applied times-frac8.2

      \[\leadsto x - \left(1 \cdot \frac{z}{\color{blue}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{\sqrt[3]{t}}{\sqrt[3]{y}}}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\]
    9. Applied associate-/r*5.1

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

    if 1.2038363056561298e-136 < z < 7.2550510220773841e-34

    1. Initial program 31.3

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

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

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

    if 7.2550510220773841e-34 < z

    1. Initial program 26.8

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

      \[\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. Using strategy rm
    4. Applied associate-/l*16.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -9.9819187612960195 \cdot 10^{-11}:\\ \;\;\;\;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.2038363056561298 \cdot 10^{-136}:\\ \;\;\;\;x - \left(1 \cdot \frac{\frac{z}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt[3]{y} \cdot \sqrt[3]{y}}}}{\frac{\sqrt[3]{t}}{\sqrt[3]{y}}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \mathbf{elif}\;z \le 7.2550510220773841 \cdot 10^{-34}:\\ \;\;\;\;x - \frac{\log \left(1 + y \cdot \left(\frac{1}{2} \cdot {z}^{2} + z\right)\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x - \left(1 \cdot \frac{z}{\frac{t}{y}} + \left(\frac{\log 1}{t} + 0.5 \cdot \frac{{z}^{2} \cdot y}{t}\right)\right)\\ \end{array}\]

Reproduce

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