Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B

Percentage Accurate: 96.4% → 99.7%
Time: 16.0s
Alternatives: 16
Speedup: 1.5×

Specification

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

\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\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 16 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: 96.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (* x (exp (fma y (- (log z) t) (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
	return x * exp(fma(y, (log(z) - t), (a * (log1p(-z) - b))));
}
function code(x, y, z, t, a, b)
	return Float64(x * exp(fma(y, Float64(log(z) - t), Float64(a * Float64(log1p(Float64(-z)) - b)))))
end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
\end{array}
Derivation
  1. Initial program 95.2%

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
  2. Step-by-step derivation
    1. fma-define95.6%

      \[\leadsto x \cdot e^{\color{blue}{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \left(1 - z\right) - b\right)\right)}} \]
    2. sub-neg95.6%

      \[\leadsto x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)\right)} \]
    3. log1p-define99.2%

      \[\leadsto x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)\right)} \]
  3. Simplified99.2%

    \[\leadsto \color{blue}{x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 91.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.25 \cdot 10^{+30} \lor \neg \left(t \leq 3.45 \cdot 10^{+205}\right):\\ \;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{y \cdot \log z - a \cdot \left(z + b\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= t -2.25e+30) (not (<= t 3.45e+205)))
   (* x (exp (* t (- y))))
   (* x (exp (- (* y (log z)) (* a (+ z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((t <= -2.25e+30) || !(t <= 3.45e+205)) {
		tmp = x * exp((t * -y));
	} else {
		tmp = x * exp(((y * log(z)) - (a * (z + b))));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if ((t <= (-2.25d+30)) .or. (.not. (t <= 3.45d+205))) then
        tmp = x * exp((t * -y))
    else
        tmp = x * exp(((y * log(z)) - (a * (z + b))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((t <= -2.25e+30) || !(t <= 3.45e+205)) {
		tmp = x * Math.exp((t * -y));
	} else {
		tmp = x * Math.exp(((y * Math.log(z)) - (a * (z + b))));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (t <= -2.25e+30) or not (t <= 3.45e+205):
		tmp = x * math.exp((t * -y))
	else:
		tmp = x * math.exp(((y * math.log(z)) - (a * (z + b))))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((t <= -2.25e+30) || !(t <= 3.45e+205))
		tmp = Float64(x * exp(Float64(t * Float64(-y))));
	else
		tmp = Float64(x * exp(Float64(Float64(y * log(z)) - Float64(a * Float64(z + b)))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((t <= -2.25e+30) || ~((t <= 3.45e+205)))
		tmp = x * exp((t * -y));
	else
		tmp = x * exp(((y * log(z)) - (a * (z + b))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.25e+30], N[Not[LessEqual[t, 3.45e+205]], $MachinePrecision]], N[(x * N[Exp[N[(t * (-y)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] - N[(a * N[(z + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{+30} \lor \neg \left(t \leq 3.45 \cdot 10^{+205}\right):\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\

\mathbf{else}:\\
\;\;\;\;x \cdot e^{y \cdot \log z - a \cdot \left(z + b\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.24999999999999997e30 or 3.4499999999999999e205 < t

    1. Initial program 98.6%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in t around inf 86.1%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(t \cdot y\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg86.1%

        \[\leadsto x \cdot e^{\color{blue}{-t \cdot y}} \]
      2. distribute-lft-neg-out86.1%

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

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    5. Simplified86.1%

      \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]

    if -2.24999999999999997e30 < t < 3.4499999999999999e205

    1. Initial program 94.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.9%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg98.9%

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

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in t around 0 98.1%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot \left(b + z\right)\right) + y \cdot \log z}} \]
    7. Step-by-step derivation
      1. +-commutative98.1%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \log z + -1 \cdot \left(a \cdot \left(b + z\right)\right)}} \]
      2. mul-1-neg98.1%

        \[\leadsto x \cdot e^{y \cdot \log z + \color{blue}{\left(-a \cdot \left(b + z\right)\right)}} \]
      3. unsub-neg98.1%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \log z - a \cdot \left(b + z\right)}} \]
    8. Simplified98.1%

      \[\leadsto x \cdot e^{\color{blue}{y \cdot \log z - a \cdot \left(b + z\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.25 \cdot 10^{+30} \lor \neg \left(t \leq 3.45 \cdot 10^{+205}\right):\\ \;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{y \cdot \log z - a \cdot \left(z + b\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 86.4% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-42} \lor \neg \left(y \leq 1.6 \cdot 10^{+19}\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.8000000000000006e-42 or 1.6e19 < y

    1. Initial program 97.8%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 90.6%

      \[\leadsto x \cdot \color{blue}{e^{y \cdot \left(\log z - t\right)}} \]
    4. Step-by-step derivation
      1. *-commutative90.6%

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

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

        \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
      4. rem-exp-log90.6%

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

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

    if -5.8000000000000006e-42 < y < 1.6e19

    1. Initial program 92.4%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 81.7%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\log \left(1 - z\right) - b\right)}} \]
    4. Step-by-step derivation
      1. sub-neg81.7%

        \[\leadsto x \cdot e^{a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)} \]
      2. log1p-define89.1%

        \[\leadsto x \cdot e^{a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)} \]
    5. Simplified89.1%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{-42} \lor \neg \left(y \leq 1.6 \cdot 10^{+19}\right):\\ \;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 83.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-46} \lor \neg \left(y \leq 4.7 \cdot 10^{-54}\right):\\ \;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -1e-46) (not (<= y 4.7e-54)))
   (* x (pow (/ z (exp t)) y))
   (* x (pow E (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -1e-46) || !(y <= 4.7e-54)) {
		tmp = x * pow((z / exp(t)), y);
	} else {
		tmp = x * pow(((double) M_E), (a * -b));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -1e-46) || !(y <= 4.7e-54)) {
		tmp = x * Math.pow((z / Math.exp(t)), y);
	} else {
		tmp = x * Math.pow(Math.E, (a * -b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -1e-46) or not (y <= 4.7e-54):
		tmp = x * math.pow((z / math.exp(t)), y)
	else:
		tmp = x * math.pow(math.e, (a * -b))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -1e-46) || !(y <= 4.7e-54))
		tmp = Float64(x * (Float64(z / exp(t)) ^ y));
	else
		tmp = Float64(x * (exp(1) ^ Float64(a * Float64(-b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -1e-46) || ~((y <= 4.7e-54)))
		tmp = x * ((z / exp(t)) ^ y);
	else
		tmp = x * (2.71828182845904523536 ^ (a * -b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1e-46], N[Not[LessEqual[y, 4.7e-54]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[E, N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-46} \lor \neg \left(y \leq 4.7 \cdot 10^{-54}\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.00000000000000002e-46 or 4.7e-54 < y

    1. Initial program 96.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 87.8%

      \[\leadsto x \cdot \color{blue}{e^{y \cdot \left(\log z - t\right)}} \]
    4. Step-by-step derivation
      1. *-commutative87.8%

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

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

        \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
      4. rem-exp-log87.8%

        \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
    5. Simplified87.8%

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

    if -1.00000000000000002e-46 < y < 4.7e-54

    1. Initial program 94.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 86.0%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\log \left(1 - z\right) - b\right)}} \]
    4. Step-by-step derivation
      1. sub-neg86.0%

        \[\leadsto x \cdot e^{a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)} \]
      2. log1p-define91.9%

        \[\leadsto x \cdot e^{a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)} \]
    5. Simplified91.9%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity91.9%

        \[\leadsto x \cdot e^{\color{blue}{1 \cdot \left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      2. exp-prod91.9%

        \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}\right) - b\right)\right)} \]
      4. sqrt-unprod83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}\right) - b\right)\right)} \]
      5. sqr-neg83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\sqrt{\color{blue}{z \cdot z}}\right) - b\right)\right)} \]
      6. sqrt-unprod83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{z} \cdot \sqrt{z}}\right) - b\right)\right)} \]
      7. add-sqr-sqrt83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{z}\right) - b\right)\right)} \]
    7. Applied egg-rr83.0%

      \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    8. Step-by-step derivation
      1. exp-1-e83.0%

        \[\leadsto x \cdot {\color{blue}{e}}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)} \]
    9. Simplified83.0%

      \[\leadsto x \cdot \color{blue}{{e}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    10. Taylor expanded in z around 0 83.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + a \cdot z\right)}} \]
    11. Step-by-step derivation
      1. +-commutative83.0%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot z + -1 \cdot \left(a \cdot b\right)\right)}} \]
      2. mul-1-neg83.0%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{\left(-a \cdot b\right)}\right)} \]
      3. distribute-rgt-neg-out83.0%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{a \cdot \left(-b\right)}\right)} \]
      4. distribute-lft-out83.0%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    12. Simplified83.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    13. Taylor expanded in z around 0 85.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(-1 \cdot \left(a \cdot b\right)\right)}} \]
    14. Step-by-step derivation
      1. associate-*r*85.0%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(\left(-1 \cdot a\right) \cdot b\right)}} \]
      2. neg-mul-185.0%

        \[\leadsto x \cdot {e}^{\left(\color{blue}{\left(-a\right)} \cdot b\right)} \]
    15. Simplified85.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(\left(-a\right) \cdot b\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-46} \lor \neg \left(y \leq 4.7 \cdot 10^{-54}\right):\\ \;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.3% accurate, 1.5× speedup?

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

\\
x \cdot e^{y \cdot \left(\log z - t\right) - a \cdot \left(z + b\right)}
\end{array}
Derivation
  1. Initial program 95.2%

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in z around 0 98.8%

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
  4. Step-by-step derivation
    1. mul-1-neg98.8%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
  5. Simplified98.8%

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
  6. Final simplification98.8%

    \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) - a \cdot \left(z + b\right)} \]
  7. Add Preprocessing

Alternative 6: 73.1% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+14} \lor \neg \left(y \leq 1.6 \cdot 10^{+19}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -9.5e+14) (not (<= y 1.6e+19)))
   (* x (pow z y))
   (* x (pow E (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -9.5e+14) || !(y <= 1.6e+19)) {
		tmp = x * pow(z, y);
	} else {
		tmp = x * pow(((double) M_E), (a * -b));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -9.5e+14) || !(y <= 1.6e+19)) {
		tmp = x * Math.pow(z, y);
	} else {
		tmp = x * Math.pow(Math.E, (a * -b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -9.5e+14) or not (y <= 1.6e+19):
		tmp = x * math.pow(z, y)
	else:
		tmp = x * math.pow(math.e, (a * -b))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -9.5e+14) || !(y <= 1.6e+19))
		tmp = Float64(x * (z ^ y));
	else
		tmp = Float64(x * (exp(1) ^ Float64(a * Float64(-b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -9.5e+14) || ~((y <= 1.6e+19)))
		tmp = x * (z ^ y);
	else
		tmp = x * (2.71828182845904523536 ^ (a * -b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -9.5e+14], N[Not[LessEqual[y, 1.6e+19]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[E, N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+14} \lor \neg \left(y \leq 1.6 \cdot 10^{+19}\right):\\
\;\;\;\;x \cdot {z}^{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.5e14 or 1.6e19 < y

    1. Initial program 97.6%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 92.0%

      \[\leadsto x \cdot \color{blue}{e^{y \cdot \left(\log z - t\right)}} \]
    4. Step-by-step derivation
      1. *-commutative92.0%

        \[\leadsto x \cdot e^{\color{blue}{\left(\log z - t\right) \cdot y}} \]
      2. exp-prod92.0%

        \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
      3. exp-diff92.0%

        \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
      4. rem-exp-log92.0%

        \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
    5. Simplified92.0%

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

      \[\leadsto x \cdot \color{blue}{{z}^{y}} \]

    if -9.5e14 < y < 1.6e19

    1. Initial program 93.1%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 78.7%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\log \left(1 - z\right) - b\right)}} \]
    4. Step-by-step derivation
      1. sub-neg78.7%

        \[\leadsto x \cdot e^{a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)} \]
      2. log1p-define85.4%

        \[\leadsto x \cdot e^{a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)} \]
    5. Simplified85.4%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity85.4%

        \[\leadsto x \cdot e^{\color{blue}{1 \cdot \left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      2. exp-prod85.4%

        \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}\right) - b\right)\right)} \]
      4. sqrt-unprod76.5%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}\right) - b\right)\right)} \]
      5. sqr-neg76.5%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\sqrt{\color{blue}{z \cdot z}}\right) - b\right)\right)} \]
      6. sqrt-unprod76.5%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{z} \cdot \sqrt{z}}\right) - b\right)\right)} \]
      7. add-sqr-sqrt76.5%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{z}\right) - b\right)\right)} \]
    7. Applied egg-rr76.5%

      \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    8. Step-by-step derivation
      1. exp-1-e76.5%

        \[\leadsto x \cdot {\color{blue}{e}}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)} \]
    9. Simplified76.5%

      \[\leadsto x \cdot \color{blue}{{e}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    10. Taylor expanded in z around 0 76.5%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + a \cdot z\right)}} \]
    11. Step-by-step derivation
      1. +-commutative76.5%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot z + -1 \cdot \left(a \cdot b\right)\right)}} \]
      2. mul-1-neg76.5%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{\left(-a \cdot b\right)}\right)} \]
      3. distribute-rgt-neg-out76.5%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{a \cdot \left(-b\right)}\right)} \]
      4. distribute-lft-out76.5%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    12. Simplified76.5%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    13. Taylor expanded in z around 0 78.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(-1 \cdot \left(a \cdot b\right)\right)}} \]
    14. Step-by-step derivation
      1. associate-*r*78.0%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(\left(-1 \cdot a\right) \cdot b\right)}} \]
      2. neg-mul-178.0%

        \[\leadsto x \cdot {e}^{\left(\color{blue}{\left(-a\right)} \cdot b\right)} \]
    15. Simplified78.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(\left(-a\right) \cdot b\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+14} \lor \neg \left(y \leq 1.6 \cdot 10^{+19}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {e}^{\left(a \cdot \left(-b\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 73.1% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{+14} \lor \neg \left(y \leq 2.8 \cdot 10^{+19}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -8.2e+14) (not (<= y 2.8e+19)))
   (* x (pow z y))
   (* x (exp (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -8.2e+14) || !(y <= 2.8e+19)) {
		tmp = x * pow(z, y);
	} else {
		tmp = x * exp((a * -b));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if ((y <= (-8.2d+14)) .or. (.not. (y <= 2.8d+19))) then
        tmp = x * (z ** y)
    else
        tmp = x * exp((a * -b))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -8.2e+14) || !(y <= 2.8e+19)) {
		tmp = x * Math.pow(z, y);
	} else {
		tmp = x * Math.exp((a * -b));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -8.2e+14) or not (y <= 2.8e+19):
		tmp = x * math.pow(z, y)
	else:
		tmp = x * math.exp((a * -b))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -8.2e+14) || !(y <= 2.8e+19))
		tmp = Float64(x * (z ^ y));
	else
		tmp = Float64(x * exp(Float64(a * Float64(-b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -8.2e+14) || ~((y <= 2.8e+19)))
		tmp = x * (z ^ y);
	else
		tmp = x * exp((a * -b));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -8.2e+14], N[Not[LessEqual[y, 2.8e+19]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+14} \lor \neg \left(y \leq 2.8 \cdot 10^{+19}\right):\\
\;\;\;\;x \cdot {z}^{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.2e14 or 2.8e19 < y

    1. Initial program 97.6%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 92.0%

      \[\leadsto x \cdot \color{blue}{e^{y \cdot \left(\log z - t\right)}} \]
    4. Step-by-step derivation
      1. *-commutative92.0%

        \[\leadsto x \cdot e^{\color{blue}{\left(\log z - t\right) \cdot y}} \]
      2. exp-prod92.0%

        \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
      3. exp-diff92.0%

        \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
      4. rem-exp-log92.0%

        \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
    5. Simplified92.0%

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

      \[\leadsto x \cdot \color{blue}{{z}^{y}} \]

    if -8.2e14 < y < 2.8e19

    1. Initial program 93.1%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 78.0%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot b\right)}} \]
    4. Step-by-step derivation
      1. mul-1-neg78.0%

        \[\leadsto x \cdot e^{\color{blue}{-a \cdot b}} \]
      2. distribute-rgt-neg-out78.0%

        \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(-b\right)}} \]
    5. Simplified78.0%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(-b\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{+14} \lor \neg \left(y \leq 2.8 \cdot 10^{+19}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 55.0% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-53} \lor \neg \left(y \leq 8.3 \cdot 10^{-47}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + a \cdot \left(z - b\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -2.6e-53) (not (<= y 8.3e-47)))
   (* x (pow z y))
   (* x (+ 1.0 (* a (- z b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -2.6e-53) || !(y <= 8.3e-47)) {
		tmp = x * pow(z, y);
	} else {
		tmp = x * (1.0 + (a * (z - b)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if ((y <= (-2.6d-53)) .or. (.not. (y <= 8.3d-47))) then
        tmp = x * (z ** y)
    else
        tmp = x * (1.0d0 + (a * (z - b)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -2.6e-53) || !(y <= 8.3e-47)) {
		tmp = x * Math.pow(z, y);
	} else {
		tmp = x * (1.0 + (a * (z - b)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -2.6e-53) or not (y <= 8.3e-47):
		tmp = x * math.pow(z, y)
	else:
		tmp = x * (1.0 + (a * (z - b)))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -2.6e-53) || !(y <= 8.3e-47))
		tmp = Float64(x * (z ^ y));
	else
		tmp = Float64(x * Float64(1.0 + Float64(a * Float64(z - b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -2.6e-53) || ~((y <= 8.3e-47)))
		tmp = x * (z ^ y);
	else
		tmp = x * (1.0 + (a * (z - b)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.6e-53], N[Not[LessEqual[y, 8.3e-47]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(a * N[(z - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-53} \lor \neg \left(y \leq 8.3 \cdot 10^{-47}\right):\\
\;\;\;\;x \cdot {z}^{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + a \cdot \left(z - b\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.59999999999999996e-53 or 8.2999999999999997e-47 < y

    1. Initial program 95.4%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 86.7%

      \[\leadsto x \cdot \color{blue}{e^{y \cdot \left(\log z - t\right)}} \]
    4. Step-by-step derivation
      1. *-commutative86.7%

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{{z}^{y}} \]

    if -2.59999999999999996e-53 < y < 8.2999999999999997e-47

    1. Initial program 95.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 85.9%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\log \left(1 - z\right) - b\right)}} \]
    4. Step-by-step derivation
      1. sub-neg85.9%

        \[\leadsto x \cdot e^{a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)} \]
      2. log1p-define90.9%

        \[\leadsto x \cdot e^{a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)} \]
    5. Simplified90.9%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity90.9%

        \[\leadsto x \cdot e^{\color{blue}{1 \cdot \left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      2. exp-prod90.9%

        \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}\right) - b\right)\right)} \]
      4. sqrt-unprod83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}\right) - b\right)\right)} \]
      5. sqr-neg83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\sqrt{\color{blue}{z \cdot z}}\right) - b\right)\right)} \]
      6. sqrt-unprod83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{z} \cdot \sqrt{z}}\right) - b\right)\right)} \]
      7. add-sqr-sqrt83.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{z}\right) - b\right)\right)} \]
    7. Applied egg-rr83.0%

      \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    8. Step-by-step derivation
      1. exp-1-e83.0%

        \[\leadsto x \cdot {\color{blue}{e}}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)} \]
    9. Simplified83.0%

      \[\leadsto x \cdot \color{blue}{{e}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    10. Taylor expanded in z around 0 83.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + a \cdot z\right)}} \]
    11. Step-by-step derivation
      1. +-commutative83.0%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot z + -1 \cdot \left(a \cdot b\right)\right)}} \]
      2. mul-1-neg83.0%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{\left(-a \cdot b\right)}\right)} \]
      3. distribute-rgt-neg-out83.0%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{a \cdot \left(-b\right)}\right)} \]
      4. distribute-lft-out83.0%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    12. Simplified83.0%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    13. Taylor expanded in a around 0 48.3%

      \[\leadsto x \cdot \color{blue}{\left(1 + a \cdot \left(\log e \cdot \left(z - b\right)\right)\right)} \]
    14. Step-by-step derivation
      1. sub-neg48.3%

        \[\leadsto x \cdot \left(1 + a \cdot \left(\log e \cdot \color{blue}{\left(z + \left(-b\right)\right)}\right)\right) \]
      2. mul-1-neg48.3%

        \[\leadsto x \cdot \left(1 + a \cdot \left(\log e \cdot \left(z + \color{blue}{-1 \cdot b}\right)\right)\right) \]
      3. log-E48.3%

        \[\leadsto x \cdot \left(1 + a \cdot \left(\color{blue}{1} \cdot \left(z + -1 \cdot b\right)\right)\right) \]
      4. mul-1-neg48.3%

        \[\leadsto x \cdot \left(1 + a \cdot \left(1 \cdot \left(z + \color{blue}{\left(-b\right)}\right)\right)\right) \]
      5. sub-neg48.3%

        \[\leadsto x \cdot \left(1 + a \cdot \left(1 \cdot \color{blue}{\left(z - b\right)}\right)\right) \]
    15. Simplified48.3%

      \[\leadsto x \cdot \color{blue}{\left(1 + a \cdot \left(1 \cdot \left(z - b\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{-53} \lor \neg \left(y \leq 8.3 \cdot 10^{-47}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 + a \cdot \left(z - b\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 32.9% accurate, 16.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-64}:\\
\;\;\;\;a \cdot \left(\frac{x}{a} - x \cdot z\right)\\

\mathbf{elif}\;y \leq 7.4 \cdot 10^{+22}:\\
\;\;\;\;x \cdot \left(1 + a \cdot \left(z - b\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot \left(-a\right)\right)\\


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

    1. Initial program 94.2%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 96.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg96.5%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified96.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 21.6%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*21.6%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg21.6%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified21.6%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 10.3%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg10.3%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg10.3%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative10.3%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified10.3%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in a around inf 20.2%

      \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \left(x \cdot z\right) + \frac{x}{a}\right)} \]
    13. Step-by-step derivation
      1. neg-mul-120.2%

        \[\leadsto a \cdot \left(\color{blue}{\left(-x \cdot z\right)} + \frac{x}{a}\right) \]
      2. +-commutative20.2%

        \[\leadsto a \cdot \color{blue}{\left(\frac{x}{a} + \left(-x \cdot z\right)\right)} \]
      3. sub-neg20.2%

        \[\leadsto a \cdot \color{blue}{\left(\frac{x}{a} - x \cdot z\right)} \]
    14. Simplified20.2%

      \[\leadsto \color{blue}{a \cdot \left(\frac{x}{a} - x \cdot z\right)} \]

    if -7.0000000000000006e-64 < y < 7.3999999999999996e22

    1. Initial program 93.7%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 82.7%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\log \left(1 - z\right) - b\right)}} \]
    4. Step-by-step derivation
      1. sub-neg82.7%

        \[\leadsto x \cdot e^{a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)} \]
      2. log1p-define88.7%

        \[\leadsto x \cdot e^{a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)} \]
    5. Simplified88.7%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity88.7%

        \[\leadsto x \cdot e^{\color{blue}{1 \cdot \left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      2. exp-prod88.7%

        \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}} \]
      3. add-sqr-sqrt0.0%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}\right) - b\right)\right)} \]
      4. sqrt-unprod80.1%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}\right) - b\right)\right)} \]
      5. sqr-neg80.1%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\sqrt{\color{blue}{z \cdot z}}\right) - b\right)\right)} \]
      6. sqrt-unprod80.1%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{\sqrt{z} \cdot \sqrt{z}}\right) - b\right)\right)} \]
      7. add-sqr-sqrt80.1%

        \[\leadsto x \cdot {\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(\color{blue}{z}\right) - b\right)\right)} \]
    7. Applied egg-rr80.1%

      \[\leadsto x \cdot \color{blue}{{\left(e^{1}\right)}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    8. Step-by-step derivation
      1. exp-1-e80.1%

        \[\leadsto x \cdot {\color{blue}{e}}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)} \]
    9. Simplified80.1%

      \[\leadsto x \cdot \color{blue}{{e}^{\left(a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}} \]
    10. Taylor expanded in z around 0 80.1%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(-1 \cdot \left(a \cdot b\right) + a \cdot z\right)}} \]
    11. Step-by-step derivation
      1. +-commutative80.1%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot z + -1 \cdot \left(a \cdot b\right)\right)}} \]
      2. mul-1-neg80.1%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{\left(-a \cdot b\right)}\right)} \]
      3. distribute-rgt-neg-out80.1%

        \[\leadsto x \cdot {e}^{\left(a \cdot z + \color{blue}{a \cdot \left(-b\right)}\right)} \]
      4. distribute-lft-out80.1%

        \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    12. Simplified80.1%

      \[\leadsto x \cdot {e}^{\color{blue}{\left(a \cdot \left(z + \left(-b\right)\right)\right)}} \]
    13. Taylor expanded in a around 0 47.4%

      \[\leadsto x \cdot \color{blue}{\left(1 + a \cdot \left(\log e \cdot \left(z - b\right)\right)\right)} \]
    14. Step-by-step derivation
      1. sub-neg47.4%

        \[\leadsto x \cdot \left(1 + a \cdot \left(\log e \cdot \color{blue}{\left(z + \left(-b\right)\right)}\right)\right) \]
      2. mul-1-neg47.4%

        \[\leadsto x \cdot \left(1 + a \cdot \left(\log e \cdot \left(z + \color{blue}{-1 \cdot b}\right)\right)\right) \]
      3. log-E47.4%

        \[\leadsto x \cdot \left(1 + a \cdot \left(\color{blue}{1} \cdot \left(z + -1 \cdot b\right)\right)\right) \]
      4. mul-1-neg47.4%

        \[\leadsto x \cdot \left(1 + a \cdot \left(1 \cdot \left(z + \color{blue}{\left(-b\right)}\right)\right)\right) \]
      5. sub-neg47.4%

        \[\leadsto x \cdot \left(1 + a \cdot \left(1 \cdot \color{blue}{\left(z - b\right)}\right)\right) \]
    15. Simplified47.4%

      \[\leadsto x \cdot \color{blue}{\left(1 + a \cdot \left(1 \cdot \left(z - b\right)\right)\right)} \]

    if 7.3999999999999996e22 < y

    1. Initial program 100.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 16.0%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*16.0%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg16.0%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified16.0%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 3.9%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg3.9%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg3.9%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative3.9%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified3.9%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 32.3%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. mul-1-neg32.3%

        \[\leadsto \color{blue}{-a \cdot \left(x \cdot z\right)} \]
      2. *-commutative32.3%

        \[\leadsto -\color{blue}{\left(x \cdot z\right) \cdot a} \]
      3. distribute-rgt-neg-in32.3%

        \[\leadsto \color{blue}{\left(x \cdot z\right) \cdot \left(-a\right)} \]
      4. associate-*r*33.2%

        \[\leadsto \color{blue}{x \cdot \left(z \cdot \left(-a\right)\right)} \]
      5. *-commutative33.2%

        \[\leadsto x \cdot \color{blue}{\left(\left(-a\right) \cdot z\right)} \]
      6. distribute-lft-neg-in33.2%

        \[\leadsto x \cdot \color{blue}{\left(-a \cdot z\right)} \]
      7. distribute-rgt-neg-in33.2%

        \[\leadsto x \cdot \color{blue}{\left(a \cdot \left(-z\right)\right)} \]
    14. Simplified33.2%

      \[\leadsto \color{blue}{x \cdot \left(a \cdot \left(-z\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification35.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-64}:\\ \;\;\;\;a \cdot \left(\frac{x}{a} - x \cdot z\right)\\ \mathbf{elif}\;y \leq 7.4 \cdot 10^{+22}:\\ \;\;\;\;x \cdot \left(1 + a \cdot \left(z - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot \left(-a\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 29.7% accurate, 18.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{-237}:\\ \;\;\;\;z \cdot \left(\frac{x}{z} - x \cdot a\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-8}:\\ \;\;\;\;x - z \cdot \left(x \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -7.2e-237)
   (* z (- (/ x z) (* x a)))
   (if (<= y 5e-8) (- x (* z (* x a))) (* a (* z (- x))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -7.2e-237) {
		tmp = z * ((x / z) - (x * a));
	} else if (y <= 5e-8) {
		tmp = x - (z * (x * a));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (y <= (-7.2d-237)) then
        tmp = z * ((x / z) - (x * a))
    else if (y <= 5d-8) then
        tmp = x - (z * (x * a))
    else
        tmp = a * (z * -x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -7.2e-237) {
		tmp = z * ((x / z) - (x * a));
	} else if (y <= 5e-8) {
		tmp = x - (z * (x * a));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= -7.2e-237:
		tmp = z * ((x / z) - (x * a))
	elif y <= 5e-8:
		tmp = x - (z * (x * a))
	else:
		tmp = a * (z * -x)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -7.2e-237)
		tmp = Float64(z * Float64(Float64(x / z) - Float64(x * a)));
	elseif (y <= 5e-8)
		tmp = Float64(x - Float64(z * Float64(x * a)));
	else
		tmp = Float64(a * Float64(z * Float64(-x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= -7.2e-237)
		tmp = z * ((x / z) - (x * a));
	elseif (y <= 5e-8)
		tmp = x - (z * (x * a));
	else
		tmp = a * (z * -x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7.2e-237], N[(z * N[(N[(x / z), $MachinePrecision] - N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e-8], N[(x - N[(z * N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(z * (-x)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-237}:\\
\;\;\;\;z \cdot \left(\frac{x}{z} - x \cdot a\right)\\

\mathbf{elif}\;y \leq 5 \cdot 10^{-8}:\\
\;\;\;\;x - z \cdot \left(x \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\


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

    1. Initial program 95.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 97.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg97.5%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified97.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 28.9%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*28.9%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg28.9%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified28.9%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 16.0%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg16.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg16.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative16.0%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified16.0%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 24.3%

      \[\leadsto \color{blue}{z \cdot \left(-1 \cdot \left(a \cdot x\right) + \frac{x}{z}\right)} \]
    13. Step-by-step derivation
      1. +-commutative24.3%

        \[\leadsto z \cdot \color{blue}{\left(\frac{x}{z} + -1 \cdot \left(a \cdot x\right)\right)} \]
      2. mul-1-neg24.3%

        \[\leadsto z \cdot \left(\frac{x}{z} + \color{blue}{\left(-a \cdot x\right)}\right) \]
      3. sub-neg24.3%

        \[\leadsto z \cdot \color{blue}{\left(\frac{x}{z} - a \cdot x\right)} \]
      4. *-commutative24.3%

        \[\leadsto z \cdot \left(\frac{x}{z} - \color{blue}{x \cdot a}\right) \]
    14. Simplified24.3%

      \[\leadsto \color{blue}{z \cdot \left(\frac{x}{z} - x \cdot a\right)} \]

    if -7.19999999999999993e-237 < y < 4.9999999999999998e-8

    1. Initial program 92.1%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 60.2%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*60.2%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg60.2%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified60.2%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 40.3%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg40.3%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg40.3%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative40.3%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified40.3%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Step-by-step derivation
      1. distribute-rgt-out--40.3%

        \[\leadsto \color{blue}{1 \cdot x - \left(z \cdot a\right) \cdot x} \]
      2. *-un-lft-identity40.3%

        \[\leadsto \color{blue}{x} - \left(z \cdot a\right) \cdot x \]
      3. associate-*l*41.5%

        \[\leadsto x - \color{blue}{z \cdot \left(a \cdot x\right)} \]
    13. Applied egg-rr41.5%

      \[\leadsto \color{blue}{x - z \cdot \left(a \cdot x\right)} \]

    if 4.9999999999999998e-8 < y

    1. Initial program 100.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 17.3%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified17.3%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg4.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg4.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative4.0%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 33.0%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. mul-1-neg33.0%

        \[\leadsto \color{blue}{-a \cdot \left(x \cdot z\right)} \]
      2. distribute-rgt-neg-out33.0%

        \[\leadsto \color{blue}{a \cdot \left(-x \cdot z\right)} \]
      3. distribute-rgt-neg-in33.0%

        \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(-z\right)\right)} \]
    14. Simplified33.0%

      \[\leadsto \color{blue}{a \cdot \left(x \cdot \left(-z\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification31.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{-237}:\\ \;\;\;\;z \cdot \left(\frac{x}{z} - x \cdot a\right)\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-8}:\\ \;\;\;\;x - z \cdot \left(x \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 29.5% accurate, 18.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{-26}:\\ \;\;\;\;a \cdot \left(\frac{x}{a} - x \cdot z\right)\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-8}:\\ \;\;\;\;x - z \cdot \left(x \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -9.2e-26)
   (* a (- (/ x a) (* x z)))
   (if (<= y 4.8e-8) (- x (* z (* x a))) (* a (* z (- x))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -9.2e-26) {
		tmp = a * ((x / a) - (x * z));
	} else if (y <= 4.8e-8) {
		tmp = x - (z * (x * a));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (y <= (-9.2d-26)) then
        tmp = a * ((x / a) - (x * z))
    else if (y <= 4.8d-8) then
        tmp = x - (z * (x * a))
    else
        tmp = a * (z * -x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -9.2e-26) {
		tmp = a * ((x / a) - (x * z));
	} else if (y <= 4.8e-8) {
		tmp = x - (z * (x * a));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= -9.2e-26:
		tmp = a * ((x / a) - (x * z))
	elif y <= 4.8e-8:
		tmp = x - (z * (x * a))
	else:
		tmp = a * (z * -x)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -9.2e-26)
		tmp = Float64(a * Float64(Float64(x / a) - Float64(x * z)));
	elseif (y <= 4.8e-8)
		tmp = Float64(x - Float64(z * Float64(x * a)));
	else
		tmp = Float64(a * Float64(z * Float64(-x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= -9.2e-26)
		tmp = a * ((x / a) - (x * z));
	elseif (y <= 4.8e-8)
		tmp = x - (z * (x * a));
	else
		tmp = a * (z * -x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -9.2e-26], N[(a * N[(N[(x / a), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e-8], N[(x - N[(z * N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(z * (-x)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{-26}:\\
\;\;\;\;a \cdot \left(\frac{x}{a} - x \cdot z\right)\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{-8}:\\
\;\;\;\;x - z \cdot \left(x \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\


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

    1. Initial program 96.2%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 96.2%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg96.2%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified96.2%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 16.0%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*16.0%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg16.0%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified16.0%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 6.1%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg6.1%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg6.1%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative6.1%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified6.1%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in a around inf 17.0%

      \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \left(x \cdot z\right) + \frac{x}{a}\right)} \]
    13. Step-by-step derivation
      1. neg-mul-117.0%

        \[\leadsto a \cdot \left(\color{blue}{\left(-x \cdot z\right)} + \frac{x}{a}\right) \]
      2. +-commutative17.0%

        \[\leadsto a \cdot \color{blue}{\left(\frac{x}{a} + \left(-x \cdot z\right)\right)} \]
      3. sub-neg17.0%

        \[\leadsto a \cdot \color{blue}{\left(\frac{x}{a} - x \cdot z\right)} \]
    14. Simplified17.0%

      \[\leadsto \color{blue}{a \cdot \left(\frac{x}{a} - x \cdot z\right)} \]

    if -9.20000000000000035e-26 < y < 4.79999999999999997e-8

    1. Initial program 92.4%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 99.9%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg99.9%

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

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 57.3%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*57.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg57.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified57.3%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 38.0%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg38.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg38.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative38.0%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified38.0%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Step-by-step derivation
      1. distribute-rgt-out--38.0%

        \[\leadsto \color{blue}{1 \cdot x - \left(z \cdot a\right) \cdot x} \]
      2. *-un-lft-identity38.0%

        \[\leadsto \color{blue}{x} - \left(z \cdot a\right) \cdot x \]
      3. associate-*l*39.5%

        \[\leadsto x - \color{blue}{z \cdot \left(a \cdot x\right)} \]
    13. Applied egg-rr39.5%

      \[\leadsto \color{blue}{x - z \cdot \left(a \cdot x\right)} \]

    if 4.79999999999999997e-8 < y

    1. Initial program 100.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 17.3%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified17.3%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg4.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg4.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative4.0%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 33.0%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. mul-1-neg33.0%

        \[\leadsto \color{blue}{-a \cdot \left(x \cdot z\right)} \]
      2. distribute-rgt-neg-out33.0%

        \[\leadsto \color{blue}{a \cdot \left(-x \cdot z\right)} \]
      3. distribute-rgt-neg-in33.0%

        \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(-z\right)\right)} \]
    14. Simplified33.0%

      \[\leadsto \color{blue}{a \cdot \left(x \cdot \left(-z\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification31.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{-26}:\\ \;\;\;\;a \cdot \left(\frac{x}{a} - x \cdot z\right)\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-8}:\\ \;\;\;\;x - z \cdot \left(x \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 27.9% accurate, 19.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.6 \cdot 10^{-24} \lor \neg \left(y \leq 2.8 \cdot 10^{-7}\right):\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -9.6e-24) (not (<= y 2.8e-7))) (* a (* z (- x))) x))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -9.6e-24) || !(y <= 2.8e-7)) {
		tmp = a * (z * -x);
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if ((y <= (-9.6d-24)) .or. (.not. (y <= 2.8d-7))) then
        tmp = a * (z * -x)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -9.6e-24) || !(y <= 2.8e-7)) {
		tmp = a * (z * -x);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -9.6e-24) or not (y <= 2.8e-7):
		tmp = a * (z * -x)
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -9.6e-24) || !(y <= 2.8e-7))
		tmp = Float64(a * Float64(z * Float64(-x)));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -9.6e-24) || ~((y <= 2.8e-7)))
		tmp = a * (z * -x);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -9.6e-24], N[Not[LessEqual[y, 2.8e-7]], $MachinePrecision]], N[(a * N[(z * (-x)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{-24} \lor \neg \left(y \leq 2.8 \cdot 10^{-7}\right):\\
\;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.5999999999999993e-24 or 2.80000000000000019e-7 < y

    1. Initial program 97.8%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 97.8%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg97.8%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified97.8%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 16.6%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*16.6%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg16.6%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified16.6%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 5.2%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg5.2%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg5.2%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative5.2%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified5.2%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 19.7%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. mul-1-neg19.7%

        \[\leadsto \color{blue}{-a \cdot \left(x \cdot z\right)} \]
      2. distribute-rgt-neg-out19.7%

        \[\leadsto \color{blue}{a \cdot \left(-x \cdot z\right)} \]
      3. distribute-rgt-neg-in19.7%

        \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(-z\right)\right)} \]
    14. Simplified19.7%

      \[\leadsto \color{blue}{a \cdot \left(x \cdot \left(-z\right)\right)} \]

    if -9.5999999999999993e-24 < y < 2.80000000000000019e-7

    1. Initial program 92.5%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 80.5%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\log \left(1 - z\right) - b\right)}} \]
    4. Step-by-step derivation
      1. sub-neg80.5%

        \[\leadsto x \cdot e^{a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)} \]
      2. log1p-define87.7%

        \[\leadsto x \cdot e^{a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)} \]
    5. Simplified87.7%

      \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}} \]
    6. Taylor expanded in a around 0 35.6%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification27.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.6 \cdot 10^{-24} \lor \neg \left(y \leq 2.8 \cdot 10^{-7}\right):\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 27.1% accurate, 26.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.85 \cdot 10^{-6}:\\ \;\;\;\;x - z \cdot \left(x \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y 1.85e-6) (- x (* z (* x a))) (* a (* z (- x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= 1.85e-6) {
		tmp = x - (z * (x * a));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (y <= 1.85d-6) then
        tmp = x - (z * (x * a))
    else
        tmp = a * (z * -x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= 1.85e-6) {
		tmp = x - (z * (x * a));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= 1.85e-6:
		tmp = x - (z * (x * a))
	else:
		tmp = a * (z * -x)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= 1.85e-6)
		tmp = Float64(x - Float64(z * Float64(x * a)));
	else
		tmp = Float64(a * Float64(z * Float64(-x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= 1.85e-6)
		tmp = x - (z * (x * a));
	else
		tmp = a * (z * -x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 1.85e-6], N[(x - N[(z * N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(z * (-x)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.85 \cdot 10^{-6}:\\
\;\;\;\;x - z \cdot \left(x \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\


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

    1. Initial program 93.9%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg98.5%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified98.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 41.1%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*41.1%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg41.1%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified41.1%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 25.5%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg25.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg25.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative25.5%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified25.5%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Step-by-step derivation
      1. distribute-rgt-out--25.5%

        \[\leadsto \color{blue}{1 \cdot x - \left(z \cdot a\right) \cdot x} \]
      2. *-un-lft-identity25.5%

        \[\leadsto \color{blue}{x} - \left(z \cdot a\right) \cdot x \]
      3. associate-*l*26.8%

        \[\leadsto x - \color{blue}{z \cdot \left(a \cdot x\right)} \]
    13. Applied egg-rr26.8%

      \[\leadsto \color{blue}{x - z \cdot \left(a \cdot x\right)} \]

    if 1.8500000000000001e-6 < y

    1. Initial program 100.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 17.3%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified17.3%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg4.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg4.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative4.0%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 33.0%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. mul-1-neg33.0%

        \[\leadsto \color{blue}{-a \cdot \left(x \cdot z\right)} \]
      2. distribute-rgt-neg-out33.0%

        \[\leadsto \color{blue}{a \cdot \left(-x \cdot z\right)} \]
      3. distribute-rgt-neg-in33.0%

        \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(-z\right)\right)} \]
    14. Simplified33.0%

      \[\leadsto \color{blue}{a \cdot \left(x \cdot \left(-z\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification28.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.85 \cdot 10^{-6}:\\ \;\;\;\;x - z \cdot \left(x \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 26.2% accurate, 26.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-8}:\\ \;\;\;\;x - a \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y 5.5e-8) (- x (* a (* x z))) (* a (* z (- x)))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= 5.5e-8) {
		tmp = x - (a * (x * z));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (y <= 5.5d-8) then
        tmp = x - (a * (x * z))
    else
        tmp = a * (z * -x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= 5.5e-8) {
		tmp = x - (a * (x * z));
	} else {
		tmp = a * (z * -x);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= 5.5e-8:
		tmp = x - (a * (x * z))
	else:
		tmp = a * (z * -x)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= 5.5e-8)
		tmp = Float64(x - Float64(a * Float64(x * z)));
	else
		tmp = Float64(a * Float64(z * Float64(-x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= 5.5e-8)
		tmp = x - (a * (x * z));
	else
		tmp = a * (z * -x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 5.5e-8], N[(x - N[(a * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(z * (-x)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-8}:\\
\;\;\;\;x - a \cdot \left(x \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\


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

    1. Initial program 93.9%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg98.5%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified98.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 41.1%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*41.1%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg41.1%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified41.1%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 25.5%

      \[\leadsto \color{blue}{x + -1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg25.5%

        \[\leadsto x + \color{blue}{\left(-a \cdot \left(x \cdot z\right)\right)} \]
      2. unsub-neg25.5%

        \[\leadsto \color{blue}{x - a \cdot \left(x \cdot z\right)} \]
      3. *-commutative25.5%

        \[\leadsto x - a \cdot \color{blue}{\left(z \cdot x\right)} \]
    11. Simplified25.5%

      \[\leadsto \color{blue}{x - a \cdot \left(z \cdot x\right)} \]

    if 5.5000000000000003e-8 < y

    1. Initial program 100.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 17.3%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified17.3%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg4.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg4.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative4.0%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 33.0%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. mul-1-neg33.0%

        \[\leadsto \color{blue}{-a \cdot \left(x \cdot z\right)} \]
      2. distribute-rgt-neg-out33.0%

        \[\leadsto \color{blue}{a \cdot \left(-x \cdot z\right)} \]
      3. distribute-rgt-neg-in33.0%

        \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(-z\right)\right)} \]
    14. Simplified33.0%

      \[\leadsto \color{blue}{a \cdot \left(x \cdot \left(-z\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification27.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-8}:\\ \;\;\;\;x - a \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 26.2% accurate, 26.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.55 \cdot 10^{-7}:\\
\;\;\;\;x \cdot \left(1 - z \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\


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

    1. Initial program 93.9%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 98.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg98.5%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified98.5%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 41.1%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*41.1%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg41.1%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified41.1%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 25.5%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg25.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg25.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative25.5%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified25.5%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]

    if 1.55e-7 < y

    1. Initial program 100.0%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{-1 \cdot z} - b\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    5. Simplified100.0%

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\color{blue}{\left(-z\right)} - b\right)} \]
    6. Taylor expanded in z around inf 17.3%

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(a \cdot z\right)}} \]
    7. Step-by-step derivation
      1. associate-*r*17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot z}} \]
      2. mul-1-neg17.3%

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot z} \]
    8. Simplified17.3%

      \[\leadsto x \cdot e^{\color{blue}{\left(-a\right) \cdot z}} \]
    9. Taylor expanded in a around 0 4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot z\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg4.0%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-a \cdot z\right)}\right) \]
      2. unsub-neg4.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - a \cdot z\right)} \]
      3. *-commutative4.0%

        \[\leadsto x \cdot \left(1 - \color{blue}{z \cdot a}\right) \]
    11. Simplified4.0%

      \[\leadsto x \cdot \color{blue}{\left(1 - z \cdot a\right)} \]
    12. Taylor expanded in z around inf 33.0%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(x \cdot z\right)\right)} \]
    13. Step-by-step derivation
      1. mul-1-neg33.0%

        \[\leadsto \color{blue}{-a \cdot \left(x \cdot z\right)} \]
      2. distribute-rgt-neg-out33.0%

        \[\leadsto \color{blue}{a \cdot \left(-x \cdot z\right)} \]
      3. distribute-rgt-neg-in33.0%

        \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(-z\right)\right)} \]
    14. Simplified33.0%

      \[\leadsto \color{blue}{a \cdot \left(x \cdot \left(-z\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification27.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.55 \cdot 10^{-7}:\\ \;\;\;\;x \cdot \left(1 - z \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(z \cdot \left(-x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 19.5% accurate, 315.0× speedup?

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

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

    \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in y around 0 56.4%

    \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\log \left(1 - z\right) - b\right)}} \]
  4. Step-by-step derivation
    1. sub-neg56.4%

      \[\leadsto x \cdot e^{a \cdot \left(\log \color{blue}{\left(1 + \left(-z\right)\right)} - b\right)} \]
    2. log1p-define60.6%

      \[\leadsto x \cdot e^{a \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right)} \]
  5. Simplified60.6%

    \[\leadsto x \cdot e^{\color{blue}{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}} \]
  6. Taylor expanded in a around 0 19.0%

    \[\leadsto \color{blue}{x} \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024088 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))