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

Percentage Accurate: 61.5% → 98.4%
Time: 14.0s
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.5% 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.4% 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 61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ x + \frac{-1}{t \cdot \left(0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}\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(-1.0 / Float64(t * Float64(0.5 + Float64(1.0 / Float64(y * expm1(z)))))))
end
code[x_, y_, z_, t_] := N[(x + N[(-1.0 / N[(t * N[(0.5 + N[(1.0 / N[(y * N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{{\left(\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}\right)}^{-1}} \]
  5. Applied egg-rr99.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-199.0%

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

    \[\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 78.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 89.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-33} \lor \neg \left(y \leq 3.5 \cdot 10^{-7}\right):\\
\;\;\;\;x + \frac{-1}{\frac{t}{y \cdot z} + t \cdot 0.5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.59999999999999994e-33 or 3.49999999999999984e-7 < y

    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. associate-+l-73.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{z} - 1\right)}\right)}{t} \]
      13. 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 60.7%

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

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

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

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

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

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

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

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

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

    if -2.59999999999999994e-33 < y < 3.49999999999999984e-7

    1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{e^{z} - 1}{t} \cdot y} \]
      3. expm1-def99.8%

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

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

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

Alternative 4: 89.6% accurate, 1.9× speedup?

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

\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 < -4.6e16 or 3.49999999999999984e-7 < y

    1. Initial program 30.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{z} - 1\right)}\right)}{t} \]
      13. 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 57.8%

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

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

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

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

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

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

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

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

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

    if -4.6e16 < y < 3.49999999999999984e-7

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.1%

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

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

        \[\leadsto x - \color{blue}{\frac{e^{z} - 1}{t} \cdot y} \]
      3. expm1-def99.8%

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

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

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

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

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

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

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

Alternative 5: 83.9% accurate, 10.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{t_1}\\


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

    1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{z} - 1\right)}\right)}{t} \]
      13. 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 81.7%

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

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

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

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

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

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

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

    if -2.1999999999999998e-9 < z

    1. Initial program 51.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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-198.6%

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

      \[\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 76.7%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 82.3% accurate, 14.0× speedup?

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

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

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


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

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{z} - 1\right)}\right)}{t} \]
      13. 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. Taylor expanded in z around 0 5.8%

      \[\leadsto x - \frac{\color{blue}{y \cdot z + 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)}}{t} \]
    5. Step-by-step derivation
      1. *-commutative5.8%

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)\right)}}{t} \]
      3. *-commutative6.1%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right) \cdot 0.5}\right)}{t} \]
      4. associate-*l*6.1%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{{z}^{2} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)}\right)}{t} \]
      5. unpow26.1%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left(z \cdot z\right)} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)\right)}{t} \]
      6. +-commutative6.1%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y + -1 \cdot {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
      7. mul-1-neg6.1%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y + \color{blue}{\left(-{y}^{2}\right)}\right) \cdot 0.5\right)\right)}{t} \]
      8. unsub-neg6.1%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y - {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
      9. unpow26.1%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - \color{blue}{y \cdot y}\right) \cdot 0.5\right)\right)}{t} \]
    6. Simplified6.1%

      \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - y \cdot y\right) \cdot 0.5\right)\right)}}{t} \]
    7. Taylor expanded in y around inf 5.5%

      \[\leadsto x - \color{blue}{-0.5 \cdot \frac{{y}^{2} \cdot {z}^{2}}{t}} \]
    8. Step-by-step derivation
      1. associate-/l*5.5%

        \[\leadsto x - -0.5 \cdot \color{blue}{\frac{{y}^{2}}{\frac{t}{{z}^{2}}}} \]
      2. unpow25.5%

        \[\leadsto x - -0.5 \cdot \frac{\color{blue}{y \cdot y}}{\frac{t}{{z}^{2}}} \]
      3. unpow25.5%

        \[\leadsto x - -0.5 \cdot \frac{y \cdot y}{\frac{t}{\color{blue}{z \cdot z}}} \]
    9. Simplified5.5%

      \[\leadsto x - \color{blue}{-0.5 \cdot \frac{y \cdot y}{\frac{t}{z \cdot z}}} \]
    10. Taylor expanded in x around inf 62.0%

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

    if -8.1999999999999998e108 < z

    1. Initial program 56.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \color{blue}{{\left(\frac{t}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}\right)}^{-1}} \]
    5. Applied egg-rr98.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-198.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 78.4% accurate, 23.3× speedup?

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

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

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


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

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{z} - 1\right)}\right)}{t} \]
      13. 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 z around 0 21.6%

      \[\leadsto x - \frac{\color{blue}{y \cdot z + 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)}}{t} \]
    5. Step-by-step derivation
      1. *-commutative21.6%

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)\right)}}{t} \]
      3. *-commutative21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right) \cdot 0.5}\right)}{t} \]
      4. associate-*l*21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{{z}^{2} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)}\right)}{t} \]
      5. unpow221.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left(z \cdot z\right)} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)\right)}{t} \]
      6. +-commutative21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y + -1 \cdot {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
      7. mul-1-neg21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y + \color{blue}{\left(-{y}^{2}\right)}\right) \cdot 0.5\right)\right)}{t} \]
      8. unsub-neg21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y - {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
      9. unpow221.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - \color{blue}{y \cdot y}\right) \cdot 0.5\right)\right)}{t} \]
    6. Simplified21.8%

      \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - y \cdot y\right) \cdot 0.5\right)\right)}}{t} \]
    7. Taylor expanded in y around inf 21.7%

      \[\leadsto x - \color{blue}{-0.5 \cdot \frac{{y}^{2} \cdot {z}^{2}}{t}} \]
    8. Step-by-step derivation
      1. associate-/l*20.3%

        \[\leadsto x - -0.5 \cdot \color{blue}{\frac{{y}^{2}}{\frac{t}{{z}^{2}}}} \]
      2. unpow220.3%

        \[\leadsto x - -0.5 \cdot \frac{\color{blue}{y \cdot y}}{\frac{t}{{z}^{2}}} \]
      3. unpow220.3%

        \[\leadsto x - -0.5 \cdot \frac{y \cdot y}{\frac{t}{\color{blue}{z \cdot z}}} \]
    9. Simplified20.3%

      \[\leadsto x - \color{blue}{-0.5 \cdot \frac{y \cdot y}{\frac{t}{z \cdot z}}} \]
    10. Taylor expanded in x around inf 62.1%

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

    if -1.9e21 < z

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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.1%

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

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

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

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

Alternative 8: 81.4% accurate, 23.3× speedup?

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

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

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


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

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \frac{\mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{z} - 1\right)}\right)}{t} \]
      13. 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 z around 0 21.6%

      \[\leadsto x - \frac{\color{blue}{y \cdot z + 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)}}{t} \]
    5. Step-by-step derivation
      1. *-commutative21.6%

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

        \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)\right)}}{t} \]
      3. *-commutative21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right) \cdot 0.5}\right)}{t} \]
      4. associate-*l*21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{{z}^{2} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)}\right)}{t} \]
      5. unpow221.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left(z \cdot z\right)} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)\right)}{t} \]
      6. +-commutative21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y + -1 \cdot {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
      7. mul-1-neg21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y + \color{blue}{\left(-{y}^{2}\right)}\right) \cdot 0.5\right)\right)}{t} \]
      8. unsub-neg21.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y - {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
      9. unpow221.8%

        \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - \color{blue}{y \cdot y}\right) \cdot 0.5\right)\right)}{t} \]
    6. Simplified21.8%

      \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - y \cdot y\right) \cdot 0.5\right)\right)}}{t} \]
    7. Taylor expanded in y around inf 21.7%

      \[\leadsto x - \color{blue}{-0.5 \cdot \frac{{y}^{2} \cdot {z}^{2}}{t}} \]
    8. Step-by-step derivation
      1. associate-/l*20.3%

        \[\leadsto x - -0.5 \cdot \color{blue}{\frac{{y}^{2}}{\frac{t}{{z}^{2}}}} \]
      2. unpow220.3%

        \[\leadsto x - -0.5 \cdot \frac{\color{blue}{y \cdot y}}{\frac{t}{{z}^{2}}} \]
      3. unpow220.3%

        \[\leadsto x - -0.5 \cdot \frac{y \cdot y}{\frac{t}{\color{blue}{z \cdot z}}} \]
    9. Simplified20.3%

      \[\leadsto x - \color{blue}{-0.5 \cdot \frac{y \cdot y}{\frac{t}{z \cdot z}}} \]
    10. Taylor expanded in x around inf 62.1%

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

    if -3.7e21 < z

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 87.4%

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

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

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

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

Alternative 9: 70.9% 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 61.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto x - \frac{\color{blue}{y \cdot z + 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)}}{t} \]
  5. Step-by-step derivation
    1. *-commutative61.3%

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

      \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, 0.5 \cdot \left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right)\right)}}{t} \]
    3. *-commutative61.3%

      \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left({z}^{2} \cdot \left(-1 \cdot {y}^{2} + y\right)\right) \cdot 0.5}\right)}{t} \]
    4. associate-*l*61.3%

      \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{{z}^{2} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)}\right)}{t} \]
    5. unpow261.3%

      \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \color{blue}{\left(z \cdot z\right)} \cdot \left(\left(-1 \cdot {y}^{2} + y\right) \cdot 0.5\right)\right)}{t} \]
    6. +-commutative61.3%

      \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y + -1 \cdot {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
    7. mul-1-neg61.3%

      \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y + \color{blue}{\left(-{y}^{2}\right)}\right) \cdot 0.5\right)\right)}{t} \]
    8. unsub-neg61.3%

      \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\color{blue}{\left(y - {y}^{2}\right)} \cdot 0.5\right)\right)}{t} \]
    9. unpow261.3%

      \[\leadsto x - \frac{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - \color{blue}{y \cdot y}\right) \cdot 0.5\right)\right)}{t} \]
  6. Simplified61.3%

    \[\leadsto x - \frac{\color{blue}{\mathsf{fma}\left(z, y, \left(z \cdot z\right) \cdot \left(\left(y - y \cdot y\right) \cdot 0.5\right)\right)}}{t} \]
  7. Taylor expanded in y around inf 52.6%

    \[\leadsto x - \color{blue}{-0.5 \cdot \frac{{y}^{2} \cdot {z}^{2}}{t}} \]
  8. Step-by-step derivation
    1. associate-/l*52.2%

      \[\leadsto x - -0.5 \cdot \color{blue}{\frac{{y}^{2}}{\frac{t}{{z}^{2}}}} \]
    2. unpow252.2%

      \[\leadsto x - -0.5 \cdot \frac{\color{blue}{y \cdot y}}{\frac{t}{{z}^{2}}} \]
    3. unpow252.2%

      \[\leadsto x - -0.5 \cdot \frac{y \cdot y}{\frac{t}{\color{blue}{z \cdot z}}} \]
  9. Simplified52.2%

    \[\leadsto x - \color{blue}{-0.5 \cdot \frac{y \cdot y}{\frac{t}{z \cdot z}}} \]
  10. Taylor expanded in x around inf 72.0%

    \[\leadsto \color{blue}{x} \]
  11. Final simplification72.0%

    \[\leadsto x \]

Developer target: 74.6% 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 2023199 
(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)))