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

Percentage Accurate: 60.8% → 98.2%
Time: 18.1s
Alternatives: 11
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 11 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: 60.8% 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 60.5%

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

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

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

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

      \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
    5. cancel-sign-sub79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
    6. +-commutative79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
    7. unsub-neg79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
    8. *-rgt-identity79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
    9. distribute-lft-out--79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
    10. expm1-def97.8%

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

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

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

Alternative 2: 88.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-22}:\\
\;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}}\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{+234}:\\
\;\;\;\;x - \frac{y}{\frac{t}{\mathsf{expm1}\left(z\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.05e-22

    1. Initial program 55.4%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--79.9%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\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. clear-num99.8%

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

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

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

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

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

      \[\leadsto x - \frac{1}{\color{blue}{0.5 \cdot t + \frac{t}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Taylor expanded in z around 0 72.5%

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

        \[\leadsto x - \frac{1}{0.5 \cdot t + \frac{t}{\color{blue}{z \cdot y}}} \]
    11. Simplified72.5%

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

    if -2.05e-22 < y < 8.19999999999999948e234

    1. Initial program 65.1%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub82.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative82.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg82.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity82.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--82.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}{t} \]
      2. associate-/l*96.4%

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

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

    if 8.19999999999999948e234 < y

    1. Initial program 1.2%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub15.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative15.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg15.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity15.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--15.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \log \left(1 + y \cdot \left(e^{z} - 1\right)\right)}{t}} \]
      2. log1p-def3.0%

        \[\leadsto \frac{-1 \cdot \color{blue}{\mathsf{log1p}\left(y \cdot \left(e^{z} - 1\right)\right)}}{t} \]
      3. expm1-def82.8%

        \[\leadsto \frac{-1 \cdot \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\right)}{t} \]
      4. neg-mul-182.8%

        \[\leadsto \frac{\color{blue}{-\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}}{t} \]
    6. Simplified82.8%

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

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

Alternative 3: 87.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{-9}:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot \left(e^{z} + -1\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -2.4e-9)
   (+ x (/ -1.0 (+ (* t 0.5) (/ t (* y (+ (exp z) -1.0))))))
   (- x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -2.4e-9) {
		tmp = x + (-1.0 / ((t * 0.5) + (t / (y * (exp(z) + -1.0)))));
	} 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 <= (-2.4d-9)) then
        tmp = x + ((-1.0d0) / ((t * 0.5d0) + (t / (y * (exp(z) + (-1.0d0))))))
    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 <= -2.4e-9) {
		tmp = x + (-1.0 / ((t * 0.5) + (t / (y * (Math.exp(z) + -1.0)))));
	} else {
		tmp = x - (y * (z / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -2.4e-9:
		tmp = x + (-1.0 / ((t * 0.5) + (t / (y * (math.exp(z) + -1.0)))))
	else:
		tmp = x - (y * (z / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -2.4e-9)
		tmp = Float64(x + Float64(-1.0 / Float64(Float64(t * 0.5) + Float64(t / Float64(y * Float64(exp(z) + -1.0))))));
	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 <= -2.4e-9)
		tmp = x + (-1.0 / ((t * 0.5) + (t / (y * (exp(z) + -1.0)))));
	else
		tmp = x - (y * (z / t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.4e-9], N[(x + N[(-1.0 / N[(N[(t * 0.5), $MachinePrecision] + N[(t / N[(y * N[(N[Exp[z], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 79.9%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub99.3%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg99.3%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity99.3%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--99.3%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\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. clear-num99.8%

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

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

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

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

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

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

    if -2.4e-9 < z

    1. Initial program 52.1%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub71.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative71.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg71.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity71.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--71.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
      10. expm1-def96.9%

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

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

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

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

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

      \[\leadsto x - \color{blue}{\frac{y \cdot z}{t}} \]
    7. Step-by-step derivation
      1. *-rgt-identity88.4%

        \[\leadsto x - \frac{y \cdot z}{\color{blue}{t \cdot 1}} \]
      2. *-commutative88.4%

        \[\leadsto x - \frac{\color{blue}{z \cdot y}}{t \cdot 1} \]
      3. times-frac90.4%

        \[\leadsto x - \color{blue}{\frac{z}{t} \cdot \frac{y}{1}} \]
      4. /-rgt-identity90.4%

        \[\leadsto x - \frac{z}{t} \cdot \color{blue}{y} \]
    8. Simplified90.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{-9}:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot \left(e^{z} + -1\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \]

Alternative 4: 89.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{t}{y \cdot z}\\ \mathbf{if}\;y \leq -65000000000:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + t_1}\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-49}:\\ \;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \left(\left(\frac{t}{y} \cdot -0.5 + t_1\right) - z \cdot \left(-0.25 \cdot \frac{t}{y} + \frac{t}{y} \cdot 0.16666666666666666\right)\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ t (* y z))))
   (if (<= y -65000000000.0)
     (+ x (/ -1.0 (+ (* t 0.5) t_1)))
     (if (<= y 1.1e-49)
       (- x (* (expm1 z) (/ y t)))
       (+
        x
        (/
         -1.0
         (+
          (* t 0.5)
          (-
           (+ (* (/ t y) -0.5) t_1)
           (* z (+ (* -0.25 (/ t y)) (* (/ t y) 0.16666666666666666)))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = t / (y * z);
	double tmp;
	if (y <= -65000000000.0) {
		tmp = x + (-1.0 / ((t * 0.5) + t_1));
	} else if (y <= 1.1e-49) {
		tmp = x - (expm1(z) * (y / t));
	} else {
		tmp = x + (-1.0 / ((t * 0.5) + ((((t / y) * -0.5) + t_1) - (z * ((-0.25 * (t / y)) + ((t / y) * 0.16666666666666666))))));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = t / (y * z);
	double tmp;
	if (y <= -65000000000.0) {
		tmp = x + (-1.0 / ((t * 0.5) + t_1));
	} else if (y <= 1.1e-49) {
		tmp = x - (Math.expm1(z) * (y / t));
	} else {
		tmp = x + (-1.0 / ((t * 0.5) + ((((t / y) * -0.5) + t_1) - (z * ((-0.25 * (t / y)) + ((t / y) * 0.16666666666666666))))));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t / (y * z)
	tmp = 0
	if y <= -65000000000.0:
		tmp = x + (-1.0 / ((t * 0.5) + t_1))
	elif y <= 1.1e-49:
		tmp = x - (math.expm1(z) * (y / t))
	else:
		tmp = x + (-1.0 / ((t * 0.5) + ((((t / y) * -0.5) + t_1) - (z * ((-0.25 * (t / y)) + ((t / y) * 0.16666666666666666))))))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t / Float64(y * z))
	tmp = 0.0
	if (y <= -65000000000.0)
		tmp = Float64(x + Float64(-1.0 / Float64(Float64(t * 0.5) + t_1)));
	elseif (y <= 1.1e-49)
		tmp = Float64(x - Float64(expm1(z) * Float64(y / t)));
	else
		tmp = Float64(x + Float64(-1.0 / Float64(Float64(t * 0.5) + Float64(Float64(Float64(Float64(t / y) * -0.5) + t_1) - Float64(z * Float64(Float64(-0.25 * Float64(t / y)) + Float64(Float64(t / y) * 0.16666666666666666)))))));
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -65000000000.0], N[(x + N[(-1.0 / N[(N[(t * 0.5), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-49], N[(x - N[(N[(Exp[z] - 1), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 / N[(N[(t * 0.5), $MachinePrecision] + N[(N[(N[(N[(t / y), $MachinePrecision] * -0.5), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(z * N[(N[(-0.25 * N[(t / y), $MachinePrecision]), $MachinePrecision] + N[(N[(t / y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{t}{y \cdot z}\\
\mathbf{if}\;y \leq -65000000000:\\
\;\;\;\;x + \frac{-1}{t \cdot 0.5 + t_1}\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{-49}:\\
\;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.5e10

    1. Initial program 55.0%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub82.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative82.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg82.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity82.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--82.4%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\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. clear-num99.8%

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

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

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

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

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

      \[\leadsto x - \frac{1}{\color{blue}{0.5 \cdot t + \frac{t}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Taylor expanded in z around 0 69.4%

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

        \[\leadsto x - \frac{1}{0.5 \cdot t + \frac{t}{\color{blue}{z \cdot y}}} \]
    11. Simplified69.4%

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

    if -6.5e10 < y < 1.09999999999999995e-49

    1. Initial program 78.5%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub88.5%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative88.5%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg88.5%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity88.5%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--88.5%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
      10. expm1-def96.9%

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

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

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

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

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

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

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

    if 1.09999999999999995e-49 < y

    1. Initial program 17.3%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub52.8%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative52.8%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg52.8%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity52.8%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--52.9%

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

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

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

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

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

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

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

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

      \[\leadsto x - \frac{1}{\color{blue}{0.5 \cdot t + \frac{t}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Taylor expanded in z around 0 82.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -65000000000:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}}\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-49}:\\ \;\;\;\;x - \mathsf{expm1}\left(z\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \left(\left(\frac{t}{y} \cdot -0.5 + \frac{t}{y \cdot z}\right) - z \cdot \left(-0.25 \cdot \frac{t}{y} + \frac{t}{y} \cdot 0.16666666666666666\right)\right)}\\ \end{array} \]

Alternative 5: 88.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-22}:\\
\;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.05e-22

    1. Initial program 55.4%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity80.0%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--79.9%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\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. clear-num99.8%

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

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

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

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

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

      \[\leadsto x - \frac{1}{\color{blue}{0.5 \cdot t + \frac{t}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Taylor expanded in z around 0 72.5%

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

        \[\leadsto x - \frac{1}{0.5 \cdot t + \frac{t}{\color{blue}{z \cdot y}}} \]
    11. Simplified72.5%

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

    if -2.05e-22 < y

    1. Initial program 62.3%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub79.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative79.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg79.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity79.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--79.8%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
      10. expm1-def97.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}}{t} \]
      2. associate-/l*93.6%

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

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

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

Alternative 6: 83.5% accurate, 10.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.36 \cdot 10^{-96}:\\ \;\;\;\;x + \frac{-1}{t \cdot 0.5 + \left(\frac{t}{y} \cdot -0.5 + \frac{t}{y \cdot z}\right)}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -1.36e-96)
   (+ x (/ -1.0 (+ (* t 0.5) (+ (* (/ t y) -0.5) (/ t (* y z))))))
   (- x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -1.36e-96) {
		tmp = x + (-1.0 / ((t * 0.5) + (((t / y) * -0.5) + (t / (y * z)))));
	} 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 <= (-1.36d-96)) then
        tmp = x + ((-1.0d0) / ((t * 0.5d0) + (((t / y) * (-0.5d0)) + (t / (y * z)))))
    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 <= -1.36e-96) {
		tmp = x + (-1.0 / ((t * 0.5) + (((t / y) * -0.5) + (t / (y * z)))));
	} else {
		tmp = x - (y * (z / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -1.36e-96:
		tmp = x + (-1.0 / ((t * 0.5) + (((t / y) * -0.5) + (t / (y * z)))))
	else:
		tmp = x - (y * (z / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -1.36e-96)
		tmp = Float64(x + Float64(-1.0 / Float64(Float64(t * 0.5) + Float64(Float64(Float64(t / y) * -0.5) + Float64(t / Float64(y * z))))));
	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 <= -1.36e-96)
		tmp = x + (-1.0 / ((t * 0.5) + (((t / y) * -0.5) + (t / (y * z)))));
	else
		tmp = x - (y * (z / t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.36e-96], N[(x + N[(-1.0 / N[(N[(t * 0.5), $MachinePrecision] + N[(N[(N[(t / y), $MachinePrecision] * -0.5), $MachinePrecision] + N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.36e-96

    1. Initial program 75.3%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub92.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative92.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg92.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity92.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--92.6%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\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. clear-num99.8%

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

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

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

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

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

      \[\leadsto x - \frac{1}{\color{blue}{0.5 \cdot t + \frac{t}{y \cdot \left(e^{z} - 1\right)}}} \]
    9. Taylor expanded in z around 0 71.2%

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

    if -1.36e-96 < z

    1. Initial program 51.3%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub71.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative71.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg71.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity71.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--71.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
      10. expm1-def96.5%

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

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

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

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

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

      \[\leadsto x - \color{blue}{\frac{y \cdot z}{t}} \]
    7. Step-by-step derivation
      1. *-rgt-identity88.7%

        \[\leadsto x - \frac{y \cdot z}{\color{blue}{t \cdot 1}} \]
      2. *-commutative88.7%

        \[\leadsto x - \frac{\color{blue}{z \cdot y}}{t \cdot 1} \]
      3. times-frac90.9%

        \[\leadsto x - \color{blue}{\frac{z}{t} \cdot \frac{y}{1}} \]
      4. /-rgt-identity90.9%

        \[\leadsto x - \frac{z}{t} \cdot \color{blue}{y} \]
    8. Simplified90.9%

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

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

Alternative 7: 80.8% accurate, 16.2× speedup?

\[\begin{array}{l} \\ x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ x (/ -1.0 (+ (* t 0.5) (/ t (* y z))))))
double code(double x, double y, double z, double t) {
	return x + (-1.0 / ((t * 0.5) + (t / (y * z))));
}
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) + (t / (y * z))))
end function
public static double code(double x, double y, double z, double t) {
	return x + (-1.0 / ((t * 0.5) + (t / (y * z))));
}
def code(x, y, z, t):
	return x + (-1.0 / ((t * 0.5) + (t / (y * z))))
function code(x, y, z, t)
	return Float64(x + Float64(-1.0 / Float64(Float64(t * 0.5) + Float64(t / Float64(y * z)))))
end
function tmp = code(x, y, z, t)
	tmp = x + (-1.0 / ((t * 0.5) + (t / (y * z))));
end
code[x_, y_, z_, t_] := N[(x + N[(-1.0 / N[(N[(t * 0.5), $MachinePrecision] + N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot z}}
\end{array}
Derivation
  1. Initial program 60.5%

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

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

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

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

      \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
    5. cancel-sign-sub79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
    6. +-commutative79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
    7. unsub-neg79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
    8. *-rgt-identity79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
    9. distribute-lft-out--79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
    10. expm1-def97.8%

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

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

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

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

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

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

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

    \[\leadsto x - \frac{1}{\color{blue}{0.5 \cdot t + \frac{t}{y \cdot \left(e^{z} - 1\right)}}} \]
  9. Taylor expanded in z around 0 80.1%

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

      \[\leadsto x - \frac{1}{0.5 \cdot t + \frac{t}{\color{blue}{z \cdot y}}} \]
  11. Simplified80.1%

    \[\leadsto x - \frac{1}{0.5 \cdot t + \frac{t}{\color{blue}{z \cdot y}}} \]
  12. Final simplification80.1%

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

Alternative 8: 70.9% accurate, 20.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{-227}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.25 \cdot 10^{-213}:\\ \;\;\;\;\frac{z}{t} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.15e-227) x (if (<= t 1.25e-213) (* (/ z t) (- y)) x)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.15e-227) {
		tmp = x;
	} else if (t <= 1.25e-213) {
		tmp = (z / t) * -y;
	} else {
		tmp = x;
	}
	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 (t <= (-1.15d-227)) then
        tmp = x
    else if (t <= 1.25d-213) then
        tmp = (z / t) * -y
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.15e-227) {
		tmp = x;
	} else if (t <= 1.25e-213) {
		tmp = (z / t) * -y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -1.15e-227:
		tmp = x
	elif t <= 1.25e-213:
		tmp = (z / t) * -y
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.15e-227)
		tmp = x;
	elseif (t <= 1.25e-213)
		tmp = Float64(Float64(z / t) * Float64(-y));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.15e-227)
		tmp = x;
	elseif (t <= 1.25e-213)
		tmp = (z / t) * -y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.15e-227], x, If[LessEqual[t, 1.25e-213], N[(N[(z / t), $MachinePrecision] * (-y)), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-227}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq 1.25 \cdot 10^{-213}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-y\right)\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.15000000000000006e-227 or 1.24999999999999994e-213 < t

    1. Initial program 64.7%

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

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

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

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

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

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg84.1%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity84.1%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--84.1%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
      10. expm1-def97.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\right)}{t} \]
    3. Simplified97.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 77.7%

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

    if -1.15000000000000006e-227 < t < 1.24999999999999994e-213

    1. Initial program 35.0%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub53.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative53.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg53.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity53.7%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--53.6%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
      10. expm1-def97.1%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{1}{t} - \frac{e^{z}}{t}\right)} \]
    6. Taylor expanded in z around 0 40.5%

      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot \frac{z}{t}\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg40.5%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{z}{t}\right)} \]
      2. distribute-frac-neg40.5%

        \[\leadsto y \cdot \color{blue}{\frac{-z}{t}} \]
    8. Simplified40.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{-227}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.25 \cdot 10^{-213}:\\ \;\;\;\;\frac{z}{t} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 9: 78.4% accurate, 23.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -27000000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \frac{y}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -27000000000.0) x (- x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -27000000000.0) {
		tmp = x;
	} else {
		tmp = x - (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) :: tmp
    if (z <= (-27000000000.0d0)) then
        tmp = x
    else
        tmp = x - (z * (y / t))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -27000000000.0) {
		tmp = x;
	} else {
		tmp = x - (z * (y / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -27000000000.0:
		tmp = x
	else:
		tmp = x - (z * (y / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -27000000000.0)
		tmp = x;
	else
		tmp = Float64(x - Float64(z * Float64(y / t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -27000000000.0)
		tmp = x;
	else
		tmp = x - (z * (y / t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -27000000000.0], x, N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 83.3%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--99.9%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\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 64.5%

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

    if -2.7e10 < z

    1. Initial program 52.1%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--72.4%

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

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

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

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

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

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

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

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

Alternative 10: 81.6% accurate, 23.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -27000000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z}{t}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -27000000000.0) x (- x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -27000000000.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 <= (-27000000000.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 <= -27000000000.0) {
		tmp = x;
	} else {
		tmp = x - (y * (z / t));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -27000000000.0:
		tmp = x
	else:
		tmp = x - (y * (z / t))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -27000000000.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 <= -27000000000.0)
		tmp = x;
	else
		tmp = x - (y * (z / t));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -27000000000.0], x, N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 83.3%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity99.9%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--99.9%

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(z\right)}\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 64.5%

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

    if -2.7e10 < z

    1. Initial program 52.1%

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

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

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

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
      5. cancel-sign-sub72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
      6. +-commutative72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
      7. unsub-neg72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
      8. *-rgt-identity72.4%

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
      9. distribute-lft-out--72.4%

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{\frac{y \cdot z}{t}} \]
    7. Step-by-step derivation
      1. *-rgt-identity86.0%

        \[\leadsto x - \frac{y \cdot z}{\color{blue}{t \cdot 1}} \]
      2. *-commutative86.0%

        \[\leadsto x - \frac{\color{blue}{z \cdot y}}{t \cdot 1} \]
      3. times-frac87.9%

        \[\leadsto x - \color{blue}{\frac{z}{t} \cdot \frac{y}{1}} \]
      4. /-rgt-identity87.9%

        \[\leadsto x - \frac{z}{t} \cdot \color{blue}{y} \]
    8. Simplified87.9%

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

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

Alternative 11: 70.3% 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 60.5%

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

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

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

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

      \[\leadsto x - \frac{\color{blue}{\mathsf{log1p}\left(\left(-y\right) - \left(-y\right) \cdot e^{z}\right)}}{t} \]
    5. cancel-sign-sub79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{\left(-y\right) + y \cdot e^{z}}\right)}{t} \]
    6. +-commutative79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} + \left(-y\right)}\right)}{t} \]
    7. unsub-neg79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot e^{z} - y}\right)}{t} \]
    8. *-rgt-identity79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot e^{z} - \color{blue}{y \cdot 1}\right)}{t} \]
    9. distribute-lft-out--79.8%

      \[\leadsto x - \frac{\mathsf{log1p}\left(\color{blue}{y \cdot \left(e^{z} - 1\right)}\right)}{t} \]
    10. expm1-def97.8%

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification68.6%

    \[\leadsto x \]

Developer target: 73.9% 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 2023308 
(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)))