System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2

Percentage Accurate: 61.1% → 98.2%
Time: 18.7s
Alternatives: 9
Speedup: 211.0×

Specification

?
\[\begin{array}{l} \\ x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
double code(double x, double y, double z, double t) {
	return x - (log(((1.0 - y) + (y * exp(z)))) / t);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x - (log(((1.0d0 - y) + (y * exp(z)))) / t)
end function
public static double code(double x, double y, double z, double t) {
	return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
def code(x, y, z, t):
	return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
function code(x, y, z, t)
	return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t))
end
function tmp = code(x, y, z, t)
	tmp = x - (log(((1.0 - y) + (y * exp(z)))) / t);
end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[N[(N[(1.0 - y), $MachinePrecision] + N[(y * N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 61.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
double code(double x, double y, double z, double t) {
	return x - (log(((1.0 - y) + (y * exp(z)))) / t);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x - (log(((1.0d0 - y) + (y * exp(z)))) / t)
end function
public static double code(double x, double y, double z, double t) {
	return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
def code(x, y, z, t):
	return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
function code(x, y, z, t)
	return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t))
end
function tmp = code(x, y, z, t)
	tmp = x - (log(((1.0 - y) + (y * exp(z)))) / t);
end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[N[(N[(1.0 - y), $MachinePrecision] + N[(y * N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\end{array}

Alternative 1: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t} \end{array} \]
(FPCore (x y z t) :precision binary64 (- x (/ (log1p (* y (expm1 z))) t)))
double code(double x, double y, double z, double t) {
	return x - (log1p((y * expm1(z))) / t);
}
public static double code(double x, double y, double z, double t) {
	return x - (Math.log1p((y * Math.expm1(z))) / t);
}
def code(x, y, z, t):
	return x - (math.log1p((y * math.expm1(z))) / t)
function code(x, y, z, t)
	return Float64(x - Float64(log1p(Float64(y * expm1(z))) / t))
end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[1 + N[(y * N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}
\end{array}
Derivation
  1. Initial program 62.9%

    \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
  2. Step-by-step derivation
    1. sub-neg62.9%

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

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

      \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
    4. cancel-sign-sub62.9%

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

      \[\leadsto x - \color{blue}{-1 \cdot \left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)} \]
    6. mul-1-neg62.9%

      \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
    7. remove-double-neg62.9%

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

    \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
  4. Final simplification98.9%

    \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t} \]

Alternative 2: 90.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+19} \lor \neg \left(y \leq 8.2 \cdot 10^{-22}\right):\\ \;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \frac{\frac{1}{z}}{y}}\\ \mathbf{else}:\\ \;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -3.8e+19) (not (<= y 8.2e-22)))
   (+ x (/ (/ -1.0 t) (+ 0.5 (/ (/ 1.0 z) y))))
   (- x (* (expm1 z) (/ y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.8e+19) || !(y <= 8.2e-22)) {
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / z) / y)));
	} else {
		tmp = x - (expm1(z) * (y / t));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -3.8e+19) || !(y <= 8.2e-22)) {
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / z) / y)));
	} else {
		tmp = x - (Math.expm1(z) * (y / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -3.8e+19) or not (y <= 8.2e-22):
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / z) / y)))
	else:
		tmp = x - (math.expm1(z) * (y / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -3.8e+19) || !(y <= 8.2e-22))
		tmp = Float64(x + Float64(Float64(-1.0 / t) / Float64(0.5 + Float64(Float64(1.0 / z) / y))));
	else
		tmp = Float64(x - Float64(expm1(z) * Float64(y / t)));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.8e+19], N[Not[LessEqual[y, 8.2e-22]], $MachinePrecision]], N[(x + N[(N[(-1.0 / t), $MachinePrecision] / N[(0.5 + N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(Exp[z] - 1), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+19} \lor \neg \left(y \leq 8.2 \cdot 10^{-22}\right):\\
\;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \frac{\frac{1}{z}}{y}}\\

\mathbf{else}:\\
\;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.8e19 or 8.1999999999999999e-22 < y

    1. Initial program 29.1%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg29.1%

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

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

        \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
      4. cancel-sign-sub29.1%

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

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

        \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
      7. remove-double-neg29.1%

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto x - \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right) \cdot \frac{1}{t}} \]
      2. *-commutative99.8%

        \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    5. Applied egg-rr99.8%

      \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-/r/99.7%

        \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      2. div-inv99.7%

        \[\leadsto x - \frac{1}{\color{blue}{t \cdot \frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      3. associate-/r*99.8%

        \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    7. Applied egg-rr99.8%

      \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    8. Taylor expanded in y around 0 58.7%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Step-by-step derivation
      1. expm1-def75.3%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}} \]
    10. Simplified75.3%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}}} \]
    11. Taylor expanded in z around 0 75.3%

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\frac{1}{y \cdot z}}} \]
    12. Step-by-step derivation
      1. *-commutative75.3%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{\color{blue}{z \cdot y}}} \]
      2. associate-/r*75.3%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\frac{\frac{1}{z}}{y}}} \]
    13. Simplified75.3%

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\frac{\frac{1}{z}}{y}}} \]

    if -3.8e19 < y < 8.1999999999999999e-22

    1. Initial program 84.3%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg84.3%

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

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

        \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
      4. cancel-sign-sub84.3%

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

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

        \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
      7. remove-double-neg84.3%

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Taylor expanded in y around 0 92.3%

      \[\leadsto x - \color{blue}{\frac{y \cdot \left(e^{z} - 1\right)}{t}} \]
    5. Step-by-step derivation
      1. associate-/l*92.3%

        \[\leadsto x - \color{blue}{\frac{y}{\frac{t}{e^{z} - 1}}} \]
      2. associate-/r/92.3%

        \[\leadsto x - \color{blue}{\frac{y}{t} \cdot \left(e^{z} - 1\right)} \]
      3. expm1-def99.4%

        \[\leadsto x - \frac{y}{t} \cdot \color{blue}{\mathsf{expm1}\left(z\right)} \]
    6. Simplified99.4%

      \[\leadsto x - \color{blue}{\frac{y}{t} \cdot \mathsf{expm1}\left(z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+19} \lor \neg \left(y \leq 8.2 \cdot 10^{-22}\right):\\ \;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \frac{\frac{1}{z}}{y}}\\ \mathbf{else}:\\ \;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\ \end{array} \]

Alternative 3: 87.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -70000000:\\ \;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \frac{0.5}{y}\right)}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{-1}{t}}{\frac{\frac{1}{y}}{\mathsf{expm1}\left(z\right)}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -70000000.0)
   (+ x (/ (/ -1.0 t) (+ 0.5 (- (/ 1.0 (* y z)) (/ 0.5 y)))))
   (+ x (/ (/ -1.0 t) (/ (/ 1.0 y) (expm1 z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -70000000.0) {
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / (y * z)) - (0.5 / y))));
	} else {
		tmp = x + ((-1.0 / t) / ((1.0 / y) / expm1(z)));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -70000000.0) {
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / (y * z)) - (0.5 / y))));
	} else {
		tmp = x + ((-1.0 / t) / ((1.0 / y) / Math.expm1(z)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -70000000.0:
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / (y * z)) - (0.5 / y))))
	else:
		tmp = x + ((-1.0 / t) / ((1.0 / y) / math.expm1(z)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -70000000.0)
		tmp = Float64(x + Float64(Float64(-1.0 / t) / Float64(0.5 + Float64(Float64(1.0 / Float64(y * z)) - Float64(0.5 / y)))));
	else
		tmp = Float64(x + Float64(Float64(-1.0 / t) / Float64(Float64(1.0 / y) / expm1(z))));
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[y, -70000000.0], N[(x + N[(N[(-1.0 / t), $MachinePrecision] / N[(0.5 + N[(N[(1.0 / N[(y * z), $MachinePrecision]), $MachinePrecision] - N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-1.0 / t), $MachinePrecision] / N[(N[(1.0 / y), $MachinePrecision] / N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -70000000:\\
\;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \frac{0.5}{y}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7e7

    1. Initial program 37.5%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg37.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto x - \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right) \cdot \frac{1}{t}} \]
      2. *-commutative99.8%

        \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    5. Applied egg-rr99.8%

      \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-/r/99.7%

        \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      2. div-inv99.7%

        \[\leadsto x - \frac{1}{\color{blue}{t \cdot \frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      3. associate-/r*99.8%

        \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    7. Applied egg-rr99.8%

      \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    8. Taylor expanded in y around 0 63.4%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Step-by-step derivation
      1. expm1-def72.1%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}} \]
    10. Simplified72.1%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}}} \]
    11. Taylor expanded in z around 0 72.1%

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\left(\frac{1}{y \cdot z} - 0.5 \cdot \frac{1}{y}\right)}} \]
    12. Step-by-step derivation
      1. associate-*r/72.1%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \color{blue}{\frac{0.5 \cdot 1}{y}}\right)} \]
      2. metadata-eval72.1%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \frac{\color{blue}{0.5}}{y}\right)} \]
    13. Simplified72.1%

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

    if -7e7 < y

    1. Initial program 71.2%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg71.2%

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

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

        \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
      4. cancel-sign-sub71.2%

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

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

        \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
      7. remove-double-neg71.2%

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Step-by-step derivation
      1. div-inv98.6%

        \[\leadsto x - \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right) \cdot \frac{1}{t}} \]
      2. *-commutative98.6%

        \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    5. Applied egg-rr98.6%

      \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-/r/98.5%

        \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      2. div-inv98.4%

        \[\leadsto x - \frac{1}{\color{blue}{t \cdot \frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      3. associate-/r*98.4%

        \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    7. Applied egg-rr98.4%

      \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    8. Taylor expanded in y around 0 84.4%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{\frac{1}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Step-by-step derivation
      1. associate-/r*84.4%

        \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{\frac{\frac{1}{y}}{e^{z} - 1}}} \]
      2. expm1-def94.0%

        \[\leadsto x - \frac{\frac{1}{t}}{\frac{\frac{1}{y}}{\color{blue}{\mathsf{expm1}\left(z\right)}}} \]
    10. Simplified94.0%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{\frac{\frac{1}{y}}{\mathsf{expm1}\left(z\right)}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -70000000:\\ \;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \frac{0.5}{y}\right)}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{-1}{t}}{\frac{\frac{1}{y}}{\mathsf{expm1}\left(z\right)}}\\ \end{array} \]

Alternative 4: 89.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ x + \frac{\frac{-1}{t}}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (/ (/ -1.0 t) (+ 0.5 (/ 1.0 (* y (expm1 z)))))))
double code(double x, double y, double z, double t) {
	return x + ((-1.0 / t) / (0.5 + (1.0 / (y * expm1(z)))));
}
public static double code(double x, double y, double z, double t) {
	return x + ((-1.0 / t) / (0.5 + (1.0 / (y * Math.expm1(z)))));
}
def code(x, y, z, t):
	return x + ((-1.0 / t) / (0.5 + (1.0 / (y * math.expm1(z)))))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(-1.0 / t) / Float64(0.5 + Float64(1.0 / Float64(y * expm1(z))))))
end
code[x_, y_, z_, t_] := N[(x + N[(N[(-1.0 / t), $MachinePrecision] / N[(0.5 + N[(1.0 / N[(y * N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{\frac{-1}{t}}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}}
\end{array}
Derivation
  1. Initial program 62.9%

    \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
  2. Step-by-step derivation
    1. sub-neg62.9%

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

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

      \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
    4. cancel-sign-sub62.9%

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

      \[\leadsto x - \color{blue}{-1 \cdot \left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)} \]
    6. mul-1-neg62.9%

      \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
    7. remove-double-neg62.9%

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

    \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
  4. Step-by-step derivation
    1. div-inv98.9%

      \[\leadsto x - \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right) \cdot \frac{1}{t}} \]
    2. *-commutative98.9%

      \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
  5. Applied egg-rr98.9%

    \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
  6. Step-by-step derivation
    1. associate-/r/98.8%

      \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    2. div-inv98.7%

      \[\leadsto x - \frac{1}{\color{blue}{t \cdot \frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    3. associate-/r*98.8%

      \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
  7. Applied egg-rr98.8%

    \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
  8. Taylor expanded in y around 0 79.3%

    \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \left(e^{z} - 1\right)}}} \]
  9. Step-by-step derivation
    1. expm1-def89.3%

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}} \]
  10. Simplified89.3%

    \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}}} \]
  11. Final simplification89.3%

    \[\leadsto x + \frac{\frac{-1}{t}}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}} \]

Alternative 5: 82.8% accurate, 11.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+62}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \frac{\frac{1}{z}}{y}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -1.8e+62) x (+ x (/ (/ -1.0 t) (+ 0.5 (/ (/ 1.0 z) y))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.8e+62) {
		tmp = x;
	} else {
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / z) / y)));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-1.8d+62)) then
        tmp = x
    else
        tmp = x + (((-1.0d0) / t) / (0.5d0 + ((1.0d0 / z) / y)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.8e+62) {
		tmp = x;
	} else {
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / z) / y)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -1.8e+62:
		tmp = x
	else:
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / z) / y)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -1.8e+62)
		tmp = x;
	else
		tmp = Float64(x + Float64(Float64(-1.0 / t) / Float64(0.5 + Float64(Float64(1.0 / z) / y))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -1.8e+62)
		tmp = x;
	else
		tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / z) / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e+62], x, N[(x + N[(N[(-1.0 / t), $MachinePrecision] / N[(0.5 + N[(N[(1.0 / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+62}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \frac{\frac{1}{z}}{y}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.8e62

    1. Initial program 83.2%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg83.2%

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

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

        \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
      4. cancel-sign-sub83.2%

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

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

        \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
      7. remove-double-neg83.2%

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Taylor expanded in x around inf 70.2%

      \[\leadsto \color{blue}{x} \]

    if -1.8e62 < z

    1. Initial program 56.9%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg56.9%

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

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

        \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
      4. cancel-sign-sub56.9%

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

        \[\leadsto x - \color{blue}{-1 \cdot \left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)} \]
      6. mul-1-neg56.9%

        \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
      7. remove-double-neg56.9%

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Step-by-step derivation
      1. div-inv98.6%

        \[\leadsto x - \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right) \cdot \frac{1}{t}} \]
      2. *-commutative98.6%

        \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    5. Applied egg-rr98.6%

      \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-/r/98.6%

        \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      2. div-inv98.4%

        \[\leadsto x - \frac{1}{\color{blue}{t \cdot \frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      3. associate-/r*98.5%

        \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    7. Applied egg-rr98.5%

      \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    8. Taylor expanded in y around 0 76.6%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Step-by-step derivation
      1. expm1-def89.7%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}} \]
    10. Simplified89.7%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}}} \]
    11. Taylor expanded in z around 0 88.9%

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\frac{1}{y \cdot z}}} \]
    12. Step-by-step derivation
      1. *-commutative88.9%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{\color{blue}{z \cdot y}}} \]
      2. associate-/r*88.9%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\frac{\frac{1}{z}}{y}}} \]
    13. Simplified88.9%

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\frac{\frac{1}{z}}{y}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8 \cdot 10^{+62}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{-1}{t}}{0.5 + \frac{\frac{1}{z}}{y}}\\ \end{array} \]

Alternative 6: 84.2% accurate, 12.4× speedup?

\[\begin{array}{l} \\ x + \frac{\frac{-1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \frac{0.5}{y}\right)} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (/ (/ -1.0 t) (+ 0.5 (- (/ 1.0 (* y z)) (/ 0.5 y))))))
double code(double x, double y, double z, double t) {
	return x + ((-1.0 / t) / (0.5 + ((1.0 / (y * z)) - (0.5 / y))));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x + (((-1.0d0) / t) / (0.5d0 + ((1.0d0 / (y * z)) - (0.5d0 / y))))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((-1.0 / t) / (0.5 + ((1.0 / (y * z)) - (0.5 / y))));
}
def code(x, y, z, t):
	return x + ((-1.0 / t) / (0.5 + ((1.0 / (y * z)) - (0.5 / y))))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(-1.0 / t) / Float64(0.5 + Float64(Float64(1.0 / Float64(y * z)) - Float64(0.5 / y)))))
end
function tmp = code(x, y, z, t)
	tmp = x + ((-1.0 / t) / (0.5 + ((1.0 / (y * z)) - (0.5 / y))));
end
code[x_, y_, z_, t_] := N[(x + N[(N[(-1.0 / t), $MachinePrecision] / N[(0.5 + N[(N[(1.0 / N[(y * z), $MachinePrecision]), $MachinePrecision] - N[(0.5 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{\frac{-1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \frac{0.5}{y}\right)}
\end{array}
Derivation
  1. Initial program 62.9%

    \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
  2. Step-by-step derivation
    1. sub-neg62.9%

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

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

      \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
    4. cancel-sign-sub62.9%

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

      \[\leadsto x - \color{blue}{-1 \cdot \left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)} \]
    6. mul-1-neg62.9%

      \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
    7. remove-double-neg62.9%

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

    \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
  4. Step-by-step derivation
    1. div-inv98.9%

      \[\leadsto x - \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right) \cdot \frac{1}{t}} \]
    2. *-commutative98.9%

      \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
  5. Applied egg-rr98.9%

    \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
  6. Step-by-step derivation
    1. associate-/r/98.8%

      \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    2. div-inv98.7%

      \[\leadsto x - \frac{1}{\color{blue}{t \cdot \frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    3. associate-/r*98.8%

      \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
  7. Applied egg-rr98.8%

    \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
  8. Taylor expanded in y around 0 79.3%

    \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \left(e^{z} - 1\right)}}} \]
  9. Step-by-step derivation
    1. expm1-def89.3%

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}} \]
  10. Simplified89.3%

    \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}}} \]
  11. Taylor expanded in z around 0 85.6%

    \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\left(\frac{1}{y \cdot z} - 0.5 \cdot \frac{1}{y}\right)}} \]
  12. Step-by-step derivation
    1. associate-*r/85.6%

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

      \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \left(\frac{1}{y \cdot z} - \frac{\color{blue}{0.5}}{y}\right)} \]
  13. Simplified85.6%

    \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \color{blue}{\left(\frac{1}{y \cdot z} - \frac{0.5}{y}\right)}} \]
  14. Final simplification85.6%

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

Alternative 7: 82.0% accurate, 17.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3200000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -3200000.0) x (- x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -3200000.0) {
		tmp = x;
	} else {
		tmp = x - (y * (z / t));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-3200000.0d0)) then
        tmp = x
    else
        tmp = x - (y * (z / t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -3200000.0) {
		tmp = x;
	} else {
		tmp = x - (y * (z / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -3200000.0:
		tmp = x
	else:
		tmp = x - (y * (z / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -3200000.0)
		tmp = x;
	else
		tmp = Float64(x - Float64(y * Float64(z / t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -3200000.0)
		tmp = x;
	else
		tmp = x - (y * (z / t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -3200000.0], x, N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3200000:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.2e6

    1. Initial program 84.5%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg84.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Taylor expanded in x around inf 72.1%

      \[\leadsto \color{blue}{x} \]

    if -3.2e6 < z

    1. Initial program 54.8%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg54.8%

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

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

        \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
      4. cancel-sign-sub54.8%

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

        \[\leadsto x - \color{blue}{-1 \cdot \left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)} \]
      6. mul-1-neg54.8%

        \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
      7. remove-double-neg54.8%

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Step-by-step derivation
      1. div-inv98.5%

        \[\leadsto x - \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right) \cdot \frac{1}{t}} \]
      2. *-commutative98.5%

        \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    5. Applied egg-rr98.5%

      \[\leadsto x - \color{blue}{\frac{1}{t} \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)} \]
    6. Step-by-step derivation
      1. associate-/r/98.5%

        \[\leadsto x - \color{blue}{\frac{1}{\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      2. div-inv98.3%

        \[\leadsto x - \frac{1}{\color{blue}{t \cdot \frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
      3. associate-/r*98.4%

        \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    7. Applied egg-rr98.4%

      \[\leadsto x - \color{blue}{\frac{\frac{1}{t}}{\frac{1}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}} \]
    8. Taylor expanded in y around 0 75.7%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Step-by-step derivation
      1. expm1-def89.5%

        \[\leadsto x - \frac{\frac{1}{t}}{0.5 + \frac{1}{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}} \]
    10. Simplified89.5%

      \[\leadsto x - \frac{\frac{1}{t}}{\color{blue}{0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}}} \]
    11. Taylor expanded in z around 0 87.4%

      \[\leadsto x - \color{blue}{\frac{y \cdot z}{t}} \]
    12. Step-by-step derivation
      1. associate-*r/88.7%

        \[\leadsto x - \color{blue}{y \cdot \frac{z}{t}} \]
    13. Simplified88.7%

      \[\leadsto x - \color{blue}{y \cdot \frac{z}{t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3200000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \]

Alternative 8: 82.0% accurate, 17.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -900000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{t}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -900000.0) x (- x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -900000.0) {
		tmp = x;
	} else {
		tmp = x - (y / (t / z));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (z <= (-900000.0d0)) then
        tmp = x
    else
        tmp = x - (y / (t / z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -900000.0) {
		tmp = x;
	} else {
		tmp = x - (y / (t / z));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -900000.0:
		tmp = x
	else:
		tmp = x - (y / (t / z))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -900000.0)
		tmp = x;
	else
		tmp = Float64(x - Float64(y / Float64(t / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -900000.0)
		tmp = x;
	else
		tmp = x - (y / (t / z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -900000.0], x, N[(x - N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -900000:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9e5

    1. Initial program 84.5%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg84.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Taylor expanded in x around inf 72.1%

      \[\leadsto \color{blue}{x} \]

    if -9e5 < z

    1. Initial program 54.8%

      \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
    2. Step-by-step derivation
      1. sub-neg54.8%

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

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

        \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
      4. cancel-sign-sub54.8%

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

        \[\leadsto x - \color{blue}{-1 \cdot \left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)} \]
      6. mul-1-neg54.8%

        \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
      7. remove-double-neg54.8%

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

      \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
    4. Taylor expanded in z around 0 87.4%

      \[\leadsto x - \color{blue}{\frac{y \cdot z}{t}} \]
    5. Step-by-step derivation
      1. associate-/l*88.8%

        \[\leadsto x - \color{blue}{\frac{y}{\frac{t}{z}}} \]
    6. Simplified88.8%

      \[\leadsto x - \color{blue}{\frac{y}{\frac{t}{z}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -900000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{t}{z}}\\ \end{array} \]

Alternative 9: 71.1% accurate, 211.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
	return x;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x
end function
public static double code(double x, double y, double z, double t) {
	return x;
}
def code(x, y, z, t):
	return x
function code(x, y, z, t)
	return x
end
function tmp = code(x, y, z, t)
	tmp = x;
end
code[x_, y_, z_, t_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 62.9%

    \[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \]
  2. Step-by-step derivation
    1. sub-neg62.9%

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

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

      \[\leadsto x + \color{blue}{\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t} \cdot -1} \]
    4. cancel-sign-sub62.9%

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

      \[\leadsto x - \color{blue}{-1 \cdot \left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)} \]
    6. mul-1-neg62.9%

      \[\leadsto x - \color{blue}{\left(-\left(-\frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}\right)\right)} \]
    7. remove-double-neg62.9%

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

    \[\leadsto \color{blue}{x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}} \]
  4. Taylor expanded in x around inf 74.3%

    \[\leadsto \color{blue}{x} \]
  5. Final simplification74.3%

    \[\leadsto x \]

Developer target: 74.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{-0.5}{y \cdot t}\\ \mathbf{if}\;z < -2.8874623088207947 \cdot 10^{+119}:\\ \;\;\;\;\left(x - \frac{t_1}{z \cdot z}\right) - t_1 \cdot \frac{\frac{2}{z}}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\log \left(1 + z \cdot y\right)}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (- 0.5) (* y t))))
   (if (< z -2.8874623088207947e+119)
     (- (- x (/ t_1 (* z z))) (* t_1 (/ (/ 2.0 z) (* z z))))
     (- x (/ (log (+ 1.0 (* z y))) t)))))
double code(double x, double y, double z, double t) {
	double t_1 = -0.5 / (y * t);
	double tmp;
	if (z < -2.8874623088207947e+119) {
		tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z)));
	} else {
		tmp = x - (log((1.0 + (z * y))) / t);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = -0.5d0 / (y * t)
    if (z < (-2.8874623088207947d+119)) then
        tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0d0 / z) / (z * z)))
    else
        tmp = x - (log((1.0d0 + (z * y))) / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = -0.5 / (y * t);
	double tmp;
	if (z < -2.8874623088207947e+119) {
		tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z)));
	} else {
		tmp = x - (Math.log((1.0 + (z * y))) / t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = -0.5 / (y * t)
	tmp = 0
	if z < -2.8874623088207947e+119:
		tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z)))
	else:
		tmp = x - (math.log((1.0 + (z * y))) / t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(-0.5) / Float64(y * t))
	tmp = 0.0
	if (z < -2.8874623088207947e+119)
		tmp = Float64(Float64(x - Float64(t_1 / Float64(z * z))) - Float64(t_1 * Float64(Float64(2.0 / z) / Float64(z * z))));
	else
		tmp = Float64(x - Float64(log(Float64(1.0 + Float64(z * y))) / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = -0.5 / (y * t);
	tmp = 0.0;
	if (z < -2.8874623088207947e+119)
		tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z)));
	else
		tmp = x - (log((1.0 + (z * y))) / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-0.5) / N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.8874623088207947e+119], N[(N[(x - N[(t$95$1 / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[(N[(2.0 / z), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[N[(1.0 + N[(z * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{-0.5}{y \cdot t}\\
\mathbf{if}\;z < -2.8874623088207947 \cdot 10^{+119}:\\
\;\;\;\;\left(x - \frac{t_1}{z \cdot z}\right) - t_1 \cdot \frac{\frac{2}{z}}{z \cdot z}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023336 
(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.0 z) (* z z)))) (- x (/ (log (+ 1.0 (* z y))) t)))

  (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))