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

Percentage Accurate: 96.4% → 99.6%
Time: 13.1s
Alternatives: 15
Speedup: 1.0×

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 15 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.6% accurate, 0.8× speedup?

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

\\
x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}
\end{array}
Derivation
  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. Step-by-step derivation
    1. +-commutative95.4%

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

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

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

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

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

    \[\leadsto x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)} \]

Alternative 2: 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}
Derivation
  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. Final simplification95.4%

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

Alternative 3: 87.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -28000000000000 \lor \neg \left(y \leq 10^{+20}\right):\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -28000000000000.0) (not (<= y 1e+20)))
   (* x (exp (* y (- (log z) t))))
   (* x (exp (* a (- (- z) b))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -28000000000000.0) || !(y <= 1e+20)) {
		tmp = x * exp((y * (log(z) - t)));
	} else {
		tmp = x * exp((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 <= (-28000000000000.0d0)) .or. (.not. (y <= 1d+20))) then
        tmp = x * exp((y * (log(z) - t)))
    else
        tmp = x * exp((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 <= -28000000000000.0) || !(y <= 1e+20)) {
		tmp = x * Math.exp((y * (Math.log(z) - t)));
	} else {
		tmp = x * Math.exp((a * (-z - b)));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -28000000000000.0) or not (y <= 1e+20):
		tmp = x * math.exp((y * (math.log(z) - t)))
	else:
		tmp = x * math.exp((a * (-z - b)))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -28000000000000.0) || !(y <= 1e+20))
		tmp = Float64(x * exp(Float64(y * Float64(log(z) - t))));
	else
		tmp = Float64(x * exp(Float64(a * Float64(Float64(-z) - b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -28000000000000.0) || ~((y <= 1e+20)))
		tmp = x * exp((y * (log(z) - t)));
	else
		tmp = x * exp((a * (-z - b)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -28000000000000.0], N[Not[LessEqual[y, 1e+20]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -28000000000000 \lor \neg \left(y \leq 10^{+20}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.8e13 or 1e20 < 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. Taylor expanded in y around inf 88.8%

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

    if -2.8e13 < y < 1e20

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot b} + -1 \cdot \left(a \cdot z\right)} \]
      3. associate-*r*88.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -28000000000000 \lor \neg \left(y \leq 10^{+20}\right):\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \end{array} \]

Alternative 4: 76.8% accurate, 2.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.4e13 or 7e19 < 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. Taylor expanded in y around inf 88.8%

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

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

    if -1.4e13 < y < 7e19

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot b} + -1 \cdot \left(a \cdot z\right)} \]
      3. associate-*r*88.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -14000000000000 \lor \neg \left(y \leq 7 \cdot 10^{+19}\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\ \end{array} \]

Alternative 5: 73.7% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -19000000000000 \lor \neg \left(y \leq 0.038\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{b \cdot \left(-a\right)}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -19000000000000.0) (not (<= y 0.038)))
   (* x (pow z y))
   (* x (exp (* b (- a))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((y <= -19000000000000.0) || !(y <= 0.038)) {
		tmp = x * pow(z, y);
	} else {
		tmp = x * exp((b * -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 <= (-19000000000000.0d0)) .or. (.not. (y <= 0.038d0))) then
        tmp = x * (z ** y)
    else
        tmp = x * exp((b * -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 <= -19000000000000.0) || !(y <= 0.038)) {
		tmp = x * Math.pow(z, y);
	} else {
		tmp = x * Math.exp((b * -a));
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if (y <= -19000000000000.0) or not (y <= 0.038):
		tmp = x * math.pow(z, y)
	else:
		tmp = x * math.exp((b * -a))
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if ((y <= -19000000000000.0) || !(y <= 0.038))
		tmp = Float64(x * (z ^ y));
	else
		tmp = Float64(x * exp(Float64(b * Float64(-a))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -19000000000000.0) || ~((y <= 0.038)))
		tmp = x * (z ^ y);
	else
		tmp = x * exp((b * -a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -19000000000000.0], N[Not[LessEqual[y, 0.038]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(b * (-a)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -19000000000000 \lor \neg \left(y \leq 0.038\right):\\
\;\;\;\;x \cdot {z}^{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.9e13 or 0.0379999999999999991 < y

    1. Initial program 96.9%

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

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

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

    if -1.9e13 < y < 0.0379999999999999991

    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. Taylor expanded in b around inf 80.7%

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative80.7%

        \[\leadsto x \cdot e^{\color{blue}{b \cdot \left(-a\right)}} \]
    4. Simplified80.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -19000000000000 \lor \neg \left(y \leq 0.038\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{b \cdot \left(-a\right)}\\ \end{array} \]

Alternative 6: 54.4% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+169}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.1000000000000001e169

    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. Taylor expanded in t around inf 89.8%

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out89.8%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified89.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative25.9%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg25.9%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg25.9%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*35.1%

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

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified35.1%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in x around 0 35.1%

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

    if -2.1000000000000001e169 < t

    1. Initial program 94.8%

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

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

      \[\leadsto \color{blue}{{z}^{y} \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.1%

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

Alternative 7: 31.6% accurate, 28.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-73}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;y \leq 0.00086:\\ \;\;\;\;x \cdot \left(1 - a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \left(-t\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -1.05e-73)
   (* t (* x (- y)))
   (if (<= y 0.00086) (* x (- 1.0 (* a b))) (* y (* x (- t))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -1.05e-73) {
		tmp = t * (x * -y);
	} else if (y <= 0.00086) {
		tmp = x * (1.0 - (a * b));
	} else {
		tmp = y * (x * -t);
	}
	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.05d-73)) then
        tmp = t * (x * -y)
    else if (y <= 0.00086d0) then
        tmp = x * (1.0d0 - (a * b))
    else
        tmp = y * (x * -t)
    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.05e-73) {
		tmp = t * (x * -y);
	} else if (y <= 0.00086) {
		tmp = x * (1.0 - (a * b));
	} else {
		tmp = y * (x * -t);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= -1.05e-73:
		tmp = t * (x * -y)
	elif y <= 0.00086:
		tmp = x * (1.0 - (a * b))
	else:
		tmp = y * (x * -t)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -1.05e-73)
		tmp = Float64(t * Float64(x * Float64(-y)));
	elseif (y <= 0.00086)
		tmp = Float64(x * Float64(1.0 - Float64(a * b)));
	else
		tmp = Float64(y * Float64(x * Float64(-t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= -1.05e-73)
		tmp = t * (x * -y);
	elseif (y <= 0.00086)
		tmp = x * (1.0 - (a * b));
	else
		tmp = y * (x * -t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.05e-73], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.00086], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * (-t)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-73}:\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\

\mathbf{elif}\;y \leq 0.00086:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\

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


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

    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. Taylor expanded in t around inf 56.7%

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out56.7%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified56.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative16.3%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg16.3%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg16.3%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*17.5%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative17.5%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified17.5%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in y around inf 17.3%

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

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

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

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(t \cdot x\right) \cdot y}\right)} - 1\right) \]
      4. associate-*l*19.7%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{t \cdot \left(x \cdot y\right)}\right)} - 1\right) \]
    10. Applied egg-rr19.7%

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(t \cdot \left(x \cdot y\right)\right)} \]
    12. Simplified19.6%

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

    if -1.0499999999999999e-73 < y < 8.59999999999999979e-4

    1. Initial program 95.7%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative85.6%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative46.0%

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

        \[\leadsto x + \color{blue}{\left(-a \cdot \left(b \cdot x\right)\right)} \]
      3. unsub-neg46.0%

        \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    7. Simplified46.0%

      \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    8. Taylor expanded in x around 0 46.8%

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

    if 8.59999999999999979e-4 < y

    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. Taylor expanded in t around inf 54.8%

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out54.8%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified54.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative11.7%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg11.7%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg11.7%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*20.5%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative20.5%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified20.5%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in y around inf 28.2%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification33.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-73}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;y \leq 0.00086:\\ \;\;\;\;x \cdot \left(1 - a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \left(-t\right)\right)\\ \end{array} \]

Alternative 8: 32.4% accurate, 28.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{+141}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\

\mathbf{elif}\;a \leq 2.2 \cdot 10^{+133}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -5.80000000000000013e141

    1. Initial program 90.1%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative78.6%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative30.0%

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

        \[\leadsto x + \color{blue}{\left(-a \cdot \left(b \cdot x\right)\right)} \]
      3. unsub-neg30.0%

        \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    7. Simplified30.0%

      \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    8. Taylor expanded in x around 0 36.3%

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

    if -5.80000000000000013e141 < a < 2.2e133

    1. Initial program 99.5%

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

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out64.9%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified64.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative31.1%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg31.1%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg31.1%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*34.3%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative34.3%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified34.3%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in x around 0 34.3%

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

    if 2.2e133 < a

    1. Initial program 84.0%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative70.2%

        \[\leadsto x \cdot e^{\color{blue}{b \cdot \left(-a\right)}} \]
    4. Simplified70.2%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative20.8%

        \[\leadsto \color{blue}{x + -1 \cdot \left(a \cdot \left(b \cdot x\right)\right)} \]
      2. mul-1-neg20.8%

        \[\leadsto x + \color{blue}{\left(-a \cdot \left(b \cdot x\right)\right)} \]
      3. unsub-neg20.8%

        \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    7. Simplified20.8%

      \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    8. Taylor expanded in a around inf 30.5%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. neg-mul-130.5%

        \[\leadsto \color{blue}{-a \cdot \left(b \cdot x\right)} \]
      2. distribute-rgt-neg-in30.5%

        \[\leadsto \color{blue}{a \cdot \left(-b \cdot x\right)} \]
      3. distribute-lft-neg-in30.5%

        \[\leadsto a \cdot \color{blue}{\left(\left(-b\right) \cdot x\right)} \]
    10. Simplified30.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.8 \cdot 10^{+141}:\\ \;\;\;\;x \cdot \left(1 - a \cdot b\right)\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{+133}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(-x \cdot b\right)\\ \end{array} \]

Alternative 9: 33.1% accurate, 28.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.9 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \left(1 - a \cdot \left(z + b\right)\right)\\

\mathbf{elif}\;a \leq 5.2 \cdot 10^{+134}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -6.9e19

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot a\right) \cdot b} + -1 \cdot \left(a \cdot z\right)} \]
      3. associate-*r*80.2%

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(1 + -1 \cdot \left(a \cdot \left(z + b\right)\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*r*37.6%

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

        \[\leadsto x \cdot \left(1 + \left(-1 \cdot a\right) \cdot \color{blue}{\left(b + z\right)}\right) \]
      3. associate-*r*37.6%

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

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

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

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

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

    if -6.9e19 < a < 5.2000000000000003e134

    1. Initial program 99.4%

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

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out66.4%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative31.0%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg31.0%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg31.0%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*34.7%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative34.7%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified34.7%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in x around 0 34.7%

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

    if 5.2000000000000003e134 < a

    1. Initial program 84.0%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative70.2%

        \[\leadsto x \cdot e^{\color{blue}{b \cdot \left(-a\right)}} \]
    4. Simplified70.2%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative20.8%

        \[\leadsto \color{blue}{x + -1 \cdot \left(a \cdot \left(b \cdot x\right)\right)} \]
      2. mul-1-neg20.8%

        \[\leadsto x + \color{blue}{\left(-a \cdot \left(b \cdot x\right)\right)} \]
      3. unsub-neg20.8%

        \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    7. Simplified20.8%

      \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    8. Taylor expanded in a around inf 30.5%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. neg-mul-130.5%

        \[\leadsto \color{blue}{-a \cdot \left(b \cdot x\right)} \]
      2. distribute-rgt-neg-in30.5%

        \[\leadsto \color{blue}{a \cdot \left(-b \cdot x\right)} \]
      3. distribute-lft-neg-in30.5%

        \[\leadsto a \cdot \color{blue}{\left(\left(-b\right) \cdot x\right)} \]
    10. Simplified30.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.9 \cdot 10^{+19}:\\ \;\;\;\;x \cdot \left(1 - a \cdot \left(z + b\right)\right)\\ \mathbf{elif}\;a \leq 5.2 \cdot 10^{+134}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(-x \cdot b\right)\\ \end{array} \]

Alternative 10: 27.4% accurate, 31.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-97} \lor \neg \left(y \leq 3.4 \cdot 10^{-8}\right):\\
\;\;\;\;a \cdot \left(-x \cdot b\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.9999999999999995e-97 or 3.4e-8 < y

    1. Initial program 94.8%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative37.1%

        \[\leadsto x \cdot e^{\color{blue}{b \cdot \left(-a\right)}} \]
    4. Simplified37.1%

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative10.3%

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

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

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

      \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    8. Taylor expanded in a around inf 17.2%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. neg-mul-117.2%

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

        \[\leadsto \color{blue}{a \cdot \left(-b \cdot x\right)} \]
      3. distribute-lft-neg-in17.2%

        \[\leadsto a \cdot \color{blue}{\left(\left(-b\right) \cdot x\right)} \]
    10. Simplified17.2%

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

    if -4.9999999999999995e-97 < y < 3.4e-8

    1. Initial program 96.3%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative86.2%

        \[\leadsto x \cdot e^{\color{blue}{b \cdot \left(-a\right)}} \]
    4. Simplified86.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-97} \lor \neg \left(y \leq 3.4 \cdot 10^{-8}\right):\\ \;\;\;\;a \cdot \left(-x \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 11: 27.0% accurate, 31.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-112} \lor \neg \left(y \leq 2.7 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot \left(-y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.49999999999999992e-112 or 2.70000000000000011e-13 < y

    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. Taylor expanded in t around inf 53.5%

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out53.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative14.6%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg14.6%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg14.6%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*18.6%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative18.6%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified18.6%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in y around inf 22.7%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg22.7%

        \[\leadsto \color{blue}{-y \cdot \left(t \cdot x\right)} \]
      2. associate-*r*21.3%

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

        \[\leadsto -\color{blue}{x \cdot \left(y \cdot t\right)} \]
      4. distribute-rgt-neg-in21.3%

        \[\leadsto \color{blue}{x \cdot \left(-y \cdot t\right)} \]
      5. distribute-lft-neg-in21.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(-y\right) \cdot t\right)} \]
    10. Simplified21.3%

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

    if -8.49999999999999992e-112 < y < 2.70000000000000011e-13

    1. Initial program 96.1%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative85.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-112} \lor \neg \left(y \leq 2.7 \cdot 10^{-13}\right):\\ \;\;\;\;x \cdot \left(-y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 12: 26.8% accurate, 31.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-112}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{-12}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y \cdot t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -8.5e-112)
   (* t (* x (- y)))
   (if (<= y 1.06e-12) x (* x (- (* y t))))))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -8.5e-112) {
		tmp = t * (x * -y);
	} else if (y <= 1.06e-12) {
		tmp = x;
	} else {
		tmp = x * -(y * t);
	}
	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.5d-112)) then
        tmp = t * (x * -y)
    else if (y <= 1.06d-12) then
        tmp = x
    else
        tmp = x * -(y * t)
    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.5e-112) {
		tmp = t * (x * -y);
	} else if (y <= 1.06e-12) {
		tmp = x;
	} else {
		tmp = x * -(y * t);
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	tmp = 0
	if y <= -8.5e-112:
		tmp = t * (x * -y)
	elif y <= 1.06e-12:
		tmp = x
	else:
		tmp = x * -(y * t)
	return tmp
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -8.5e-112)
		tmp = Float64(t * Float64(x * Float64(-y)));
	elseif (y <= 1.06e-12)
		tmp = x;
	else
		tmp = Float64(x * Float64(-Float64(y * t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (y <= -8.5e-112)
		tmp = t * (x * -y);
	elseif (y <= 1.06e-12)
		tmp = x;
	else
		tmp = x * -(y * t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -8.5e-112], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.06e-12], x, N[(x * (-N[(y * t), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-112}:\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\

\mathbf{elif}\;y \leq 1.06 \cdot 10^{-12}:\\
\;\;\;\;x\\

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


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

    1. Initial program 94.8%

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

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out53.6%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified53.6%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative16.7%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg16.7%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg16.7%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*17.7%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative17.7%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified17.7%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in y around inf 18.5%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. expm1-log1p-u12.6%

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

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

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(t \cdot x\right) \cdot y}\right)} - 1\right) \]
      4. associate-*l*22.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{t \cdot \left(x \cdot y\right)}\right)} - 1\right) \]
    10. Applied egg-rr22.6%

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

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

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

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

    if -8.49999999999999992e-112 < y < 1.0599999999999999e-12

    1. Initial program 96.1%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative85.4%

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

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

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

    if 1.0599999999999999e-12 < y

    1. Initial program 95.3%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified53.2%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative11.4%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg11.4%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg11.4%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*19.9%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative19.9%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified19.9%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in y around inf 28.8%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg28.8%

        \[\leadsto \color{blue}{-y \cdot \left(t \cdot x\right)} \]
      2. associate-*r*25.3%

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

        \[\leadsto -\color{blue}{x \cdot \left(y \cdot t\right)} \]
      4. distribute-rgt-neg-in25.3%

        \[\leadsto \color{blue}{x \cdot \left(-y \cdot t\right)} \]
      5. distribute-lft-neg-in25.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(-y\right) \cdot t\right)} \]
    10. Simplified25.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{-112}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{-12}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y \cdot t\right)\\ \end{array} \]

Alternative 13: 27.2% accurate, 31.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-112}:\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\

\mathbf{elif}\;y \leq 1.15 \cdot 10^{-12}:\\
\;\;\;\;x\\

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


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

    1. Initial program 94.8%

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

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

        \[\leadsto x \cdot e^{\color{blue}{-y \cdot t}} \]
      2. distribute-rgt-neg-out53.6%

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified53.6%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative16.7%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg16.7%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg16.7%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*17.7%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative17.7%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified17.7%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in y around inf 18.5%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. expm1-log1p-u12.6%

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

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

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\left(t \cdot x\right) \cdot y}\right)} - 1\right) \]
      4. associate-*l*22.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{t \cdot \left(x \cdot y\right)}\right)} - 1\right) \]
    10. Applied egg-rr22.6%

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

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

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

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

    if -6.99999999999999988e-112 < y < 1.14999999999999995e-12

    1. Initial program 96.1%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative85.4%

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

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

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

    if 1.14999999999999995e-12 < y

    1. Initial program 95.3%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
    4. Simplified53.2%

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative11.4%

        \[\leadsto \color{blue}{x + -1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
      2. mul-1-neg11.4%

        \[\leadsto x + \color{blue}{\left(-y \cdot \left(t \cdot x\right)\right)} \]
      3. unsub-neg11.4%

        \[\leadsto \color{blue}{x - y \cdot \left(t \cdot x\right)} \]
      4. associate-*r*19.9%

        \[\leadsto x - \color{blue}{\left(y \cdot t\right) \cdot x} \]
      5. *-commutative19.9%

        \[\leadsto x - \color{blue}{x \cdot \left(y \cdot t\right)} \]
    7. Simplified19.9%

      \[\leadsto \color{blue}{x - x \cdot \left(y \cdot t\right)} \]
    8. Taylor expanded in y around inf 28.8%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification29.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-112}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-12}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \left(-t\right)\right)\\ \end{array} \]

Alternative 14: 23.4% accurate, 44.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.0033:\\
\;\;\;\;x\\

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


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

    1. Initial program 95.5%

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{\left(-a\right)} \cdot b} \]
      3. *-commutative64.9%

        \[\leadsto x \cdot e^{\color{blue}{b \cdot \left(-a\right)}} \]
    4. Simplified64.9%

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

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

    if 0.0033 < y

    1. Initial program 95.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right) + x} \]
    6. Step-by-step derivation
      1. +-commutative6.5%

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

        \[\leadsto x + \color{blue}{\left(-a \cdot \left(b \cdot x\right)\right)} \]
      3. unsub-neg6.5%

        \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    7. Simplified6.5%

      \[\leadsto \color{blue}{x - a \cdot \left(b \cdot x\right)} \]
    8. Taylor expanded in a around inf 20.4%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(b \cdot x\right)\right)} \]
    9. Step-by-step derivation
      1. neg-mul-120.4%

        \[\leadsto \color{blue}{-a \cdot \left(b \cdot x\right)} \]
      2. distribute-rgt-neg-in20.4%

        \[\leadsto \color{blue}{a \cdot \left(-b \cdot x\right)} \]
      3. distribute-lft-neg-in20.4%

        \[\leadsto a \cdot \color{blue}{\left(\left(-b\right) \cdot x\right)} \]
    10. Simplified20.4%

      \[\leadsto \color{blue}{a \cdot \left(\left(-b\right) \cdot x\right)} \]
    11. Step-by-step derivation
      1. expm1-log1p-u19.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot \left(\left(-b\right) \cdot x\right)\right)\right)} \]
      2. expm1-udef44.8%

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(a \cdot \left(\color{blue}{b} \cdot x\right)\right)} - 1 \]
      8. *-commutative41.7%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(a \cdot \left(x \cdot b\right)\right)} - 1} \]
    13. Step-by-step derivation
      1. expm1-def16.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot \left(x \cdot b\right)\right)\right)} \]
      2. expm1-log1p18.7%

        \[\leadsto \color{blue}{a \cdot \left(x \cdot b\right)} \]
    14. Simplified18.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 0.0033:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot b\right)\\ \end{array} \]

Alternative 15: 19.8% 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.4%

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification18.4%

    \[\leadsto x \]

Reproduce

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