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

Percentage Accurate: 96.6% → 99.6%
Time: 20.2s
Alternatives: 13
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 13 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.6% 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(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 96.9%

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

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

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

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

    \[\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: 83.0% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-108} \lor \neg \left(y \leq 1.18 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.8000000000000002e-108 or 1.17999999999999997e-32 < y

    1. Initial program 97.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-define97.7%

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

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

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

      \[\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. Taylor expanded in a around 0 82.7%

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

    if -5.8000000000000002e-108 < y < 1.17999999999999997e-32

    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. Add Preprocessing
    3. Taylor expanded in z around 0 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.2% 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 96.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.7%

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

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

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

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

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

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

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

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

Alternative 4: 70.3% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{if}\;t \leq -255:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 2.35 \cdot 10^{-80}:\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{+134}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* x (exp (* t (- y))))))
   (if (<= t -255.0)
     t_1
     (if (<= t 2.35e-80)
       (* x (pow z y))
       (if (<= t 1.15e+134) (* x (exp (* a (- b)))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x * exp((t * -y));
	double tmp;
	if (t <= -255.0) {
		tmp = t_1;
	} else if (t <= 2.35e-80) {
		tmp = x * pow(z, y);
	} else if (t <= 1.15e+134) {
		tmp = x * exp((a * -b));
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = x * exp((t * -y))
    if (t <= (-255.0d0)) then
        tmp = t_1
    else if (t <= 2.35d-80) then
        tmp = x * (z ** y)
    else if (t <= 1.15d+134) then
        tmp = x * exp((a * -b))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x * Math.exp((t * -y));
	double tmp;
	if (t <= -255.0) {
		tmp = t_1;
	} else if (t <= 2.35e-80) {
		tmp = x * Math.pow(z, y);
	} else if (t <= 1.15e+134) {
		tmp = x * Math.exp((a * -b));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = x * math.exp((t * -y))
	tmp = 0
	if t <= -255.0:
		tmp = t_1
	elif t <= 2.35e-80:
		tmp = x * math.pow(z, y)
	elif t <= 1.15e+134:
		tmp = x * math.exp((a * -b))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(x * exp(Float64(t * Float64(-y))))
	tmp = 0.0
	if (t <= -255.0)
		tmp = t_1;
	elseif (t <= 2.35e-80)
		tmp = Float64(x * (z ^ y));
	elseif (t <= 1.15e+134)
		tmp = Float64(x * exp(Float64(a * Float64(-b))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = x * exp((t * -y));
	tmp = 0.0;
	if (t <= -255.0)
		tmp = t_1;
	elseif (t <= 2.35e-80)
		tmp = x * (z ^ y);
	elseif (t <= 1.15e+134)
		tmp = x * exp((a * -b));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(t * (-y)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -255.0], t$95$1, If[LessEqual[t, 2.35e-80], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e+134], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot e^{t \cdot \left(-y\right)}\\
\mathbf{if}\;t \leq -255:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 2.35 \cdot 10^{-80}:\\
\;\;\;\;x \cdot {z}^{y}\\

\mathbf{elif}\;t \leq 1.15 \cdot 10^{+134}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -255 or 1.1499999999999999e134 < t

    1. Initial program 96.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 z around 0 97.7%

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

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

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

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

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

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

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

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

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

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

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

    if -255 < t < 2.34999999999999986e-80

    1. Initial program 97.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. fma-define97.4%

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

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

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

      \[\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. Taylor expanded in a around 0 72.0%

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

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

    if 2.34999999999999986e-80 < t < 1.1499999999999999e134

    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. Add Preprocessing
    3. Taylor expanded in z around 0 98.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -255:\\ \;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{elif}\;t \leq 2.35 \cdot 10^{-80}:\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{+134}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+52} \lor \neg \left(y \leq 2.2 \cdot 10^{-7}\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 -3.4e+52) (not (<= y 2.2e-7)))
   (* 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 <= -3.4e+52) || !(y <= 2.2e-7)) {
		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 <= (-3.4d+52)) .or. (.not. (y <= 2.2d-7))) 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 <= -3.4e+52) || !(y <= 2.2e-7)) {
		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 <= -3.4e+52) or not (y <= 2.2e-7):
		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 <= -3.4e+52) || !(y <= 2.2e-7))
		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 <= -3.4e+52) || ~((y <= 2.2e-7)))
		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, -3.4e+52], N[Not[LessEqual[y, 2.2e-7]], $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 -3.4 \cdot 10^{+52} \lor \neg \left(y \leq 2.2 \cdot 10^{-7}\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 < -3.4e52 or 2.2000000000000001e-7 < 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. Step-by-step derivation
      1. fma-define98.4%

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

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

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

      \[\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. Taylor expanded in a around 0 88.1%

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

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

    if -3.4e52 < y < 2.2000000000000001e-7

    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 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 54.5% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.35 \cdot 10^{+87}:\\ \;\;\;\;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 -1.35e+87) (* 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 <= -1.35e+87) {
		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 <= (-1.35d+87)) 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 <= -1.35e+87) {
		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 <= -1.35e+87:
		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 <= -1.35e+87)
		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 <= -1.35e+87)
		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, -1.35e+87], 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 -1.35 \cdot 10^{+87}:\\
\;\;\;\;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 < -1.35000000000000003e87

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e87 < t

    1. Initial program 97.3%

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

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

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

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

      \[\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. Taylor expanded in a around 0 70.5%

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

      \[\leadsto \color{blue}{x \cdot {z}^{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 30.6% accurate, 16.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+51} \lor \neg \left(t \leq 4.3 \cdot 10^{+145}\right):\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.7999999999999997e51 or 4.29999999999999998e145 < t

    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. Add Preprocessing
    3. Taylor expanded in z around 0 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.7999999999999997e51 < t < 4.29999999999999998e145

    1. Initial program 97.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 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto b \cdot \color{blue}{\left(\frac{x}{b} - a \cdot x\right)} \]
      4. *-commutative33.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.8 \cdot 10^{+51} \lor \neg \left(t \leq 4.3 \cdot 10^{+145}\right):\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(\frac{x}{b} - x \cdot a\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 29.1% accurate, 18.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{+90} \lor \neg \left(t \leq 2.95 \cdot 10^{+147}\right):\\
\;\;\;\;y \cdot \left(t \cdot \left(-x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.6000000000000002e90 or 2.9500000000000001e147 < t

    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. Add Preprocessing
    3. Taylor expanded in z around 0 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot \left(x \cdot y\right)} \]
    11. Simplified26.0%

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

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

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

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

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

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

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

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

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

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

    if -7.6000000000000002e90 < t < 2.9500000000000001e147

    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. Add Preprocessing
    3. Taylor expanded in z around 0 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.6 \cdot 10^{+90} \lor \neg \left(t \leq 2.95 \cdot 10^{+147}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - a \cdot b\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 29.7% accurate, 18.5× speedup?

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

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

\mathbf{elif}\;b \leq 4.8 \cdot 10^{+146}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -4.4999999999999996e31

    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. Add Preprocessing
    3. Taylor expanded in z around 0 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.4999999999999996e31 < b < 4.8000000000000004e146

    1. Initial program 97.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 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.8000000000000004e146 < b

    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 z around 0 96.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot \left(x \cdot y\right)} \]
    11. Simplified11.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.5 \cdot 10^{+31}:\\ \;\;\;\;x \cdot \left(1 - a \cdot b\right)\\ \mathbf{elif}\;b \leq 4.8 \cdot 10^{+146}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 25.6% accurate, 19.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+151} \lor \neg \left(y \leq 8200\right):\\
\;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.65000000000000012e151 or 8200 < y

    1. Initial program 97.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.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(a \cdot \left(-b\right)\right)} \]
    14. Simplified22.9%

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

    if -1.65000000000000012e151 < y < 8200

    1. Initial program 96.8%

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

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

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

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

      \[\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. Taylor expanded in a around 0 65.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{+151} \lor \neg \left(y \leq 8200\right):\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 28.0% accurate, 19.6× speedup?

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

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

\mathbf{elif}\;y \leq 8200:\\
\;\;\;\;x\\

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


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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.10000000000000008e-22 < y < 8200

    1. Initial program 96.6%

      \[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-define96.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-neg96.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.9%

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

      \[\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. Taylor expanded in a around 0 58.4%

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

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

    if 8200 < 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. Add Preprocessing
    3. Taylor expanded in z around 0 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-22}:\\ \;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{elif}\;y \leq 8200:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 26.9% accurate, 19.6× speedup?

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

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

\mathbf{elif}\;y \leq 8200:\\
\;\;\;\;x\\

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


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

    1. Initial program 97.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 z around 0 98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \left(\color{blue}{\left(-t\right)} \cdot x\right) \]
    14. Simplified16.8%

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

    if -2.29999999999999991e-81 < y < 8200

    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. Step-by-step derivation
      1. fma-define96.2%

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

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

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

      \[\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. Taylor expanded in a around 0 58.8%

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

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

    if 8200 < 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. Add Preprocessing
    3. Taylor expanded in z around 0 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{-81}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-x\right)\right)\\ \mathbf{elif}\;y \leq 8200:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(a \cdot \left(-b\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 18.9% 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 96.9%

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

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

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

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

    \[\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. Taylor expanded in a around 0 73.2%

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

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

Reproduce

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