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

Percentage Accurate: 96.5% → 99.7%
Time: 24.1s
Alternatives: 14
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 14 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.8× speedup?

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

\\
x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
\end{array}
Derivation
  1. Initial program 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.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.6%

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

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

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

Alternative 2: 87.3% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{-89} \lor \neg \left(y \leq 2.5 \cdot 10^{-35}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) - z \cdot a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.2000000000000002e-89 or 2.49999999999999982e-35 < y

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(\log z - t\right) - a \cdot z}} \]
      4. *-commutative90.8%

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

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

    if -4.2000000000000002e-89 < y < 2.49999999999999982e-35

    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 y around 0 89.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{-89} \lor \neg \left(y \leq 2.5 \cdot 10^{-35}\right):\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) - z \cdot a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 87.2% accurate, 1.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.46000000000000002 or 2.80000000000000004e-21 < y

    1. Initial program 98.0%

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

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

    if -0.46000000000000002 < y < 2.80000000000000004e-21

    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 y around 0 83.5%

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

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

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

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

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

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

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

Alternative 4: 83.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-89} \lor \neg \left(y \leq 9.6 \cdot 10^{-33}\right):\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{-a \cdot b}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -4.8e-89) (not (<= y 9.6e-33)))
   (* 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 <= -4.8e-89) || !(y <= 9.6e-33)) {
		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 <= (-4.8d-89)) .or. (.not. (y <= 9.6d-33))) 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 <= -4.8e-89) || !(y <= 9.6e-33)) {
		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 <= -4.8e-89) or not (y <= 9.6e-33):
		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 <= -4.8e-89) || !(y <= 9.6e-33))
		tmp = Float64(x * exp(Float64(y * Float64(log(z) - t))));
	else
		tmp = Float64(x * exp(Float64(-Float64(a * b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -4.8e-89) || ~((y <= 9.6e-33)))
		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, -4.8e-89], N[Not[LessEqual[y, 9.6e-33]], $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 -4.8 \cdot 10^{-89} \lor \neg \left(y \leq 9.6 \cdot 10^{-33}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\

\mathbf{else}:\\
\;\;\;\;x \cdot e^{-a \cdot b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.80000000000000032e-89 or 9.6e-33 < y

    1. Initial program 97.6%

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

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

    if -4.80000000000000032e-89 < y < 9.6e-33

    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 b around inf 88.3%

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

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

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

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

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

Alternative 5: 99.3% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 73.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{+19} \lor \neg \left(y \leq 0.00013\right):\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{-a \cdot b}\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= y -7.2e+19) (not (<= y 0.00013)))
   (* 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 <= -7.2e+19) || !(y <= 0.00013)) {
		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 <= (-7.2d+19)) .or. (.not. (y <= 0.00013d0))) 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 <= -7.2e+19) || !(y <= 0.00013)) {
		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 <= -7.2e+19) or not (y <= 0.00013):
		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 <= -7.2e+19) || !(y <= 0.00013))
		tmp = Float64(x * (z ^ y));
	else
		tmp = Float64(x * exp(Float64(-Float64(a * b))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if ((y <= -7.2e+19) || ~((y <= 0.00013)))
		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, -7.2e+19], N[Not[LessEqual[y, 0.00013]], $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 -7.2 \cdot 10^{+19} \lor \neg \left(y \leq 0.00013\right):\\
\;\;\;\;x \cdot {z}^{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot e^{-a \cdot b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.2e19 or 1.29999999999999989e-4 < y

    1. Initial program 98.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 y around inf 90.7%

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

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

    if -7.2e19 < y < 1.29999999999999989e-4

    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 b around inf 79.6%

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

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

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

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

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

Alternative 7: 70.7% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-19} \lor \neg \left(b \leq 7.5 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot e^{-a \cdot b}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -5.0000000000000004e-19 or 7.5e-12 < b

    1. Initial program 99.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 b around inf 82.0%

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

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

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

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

    if -5.0000000000000004e-19 < b < 7.5e-12

    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. Add Preprocessing
    3. Taylor expanded in t around inf 63.4%

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

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

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

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

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

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

Alternative 8: 55.7% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-17} \lor \neg \left(y \leq 7.2 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot {z}^{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.00000000000000029e-17 or 7.20000000000000018e-5 < y

    1. Initial program 98.4%

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

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

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

    if -4.00000000000000029e-17 < y < 7.20000000000000018e-5

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 26.6% accurate, 19.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \cdot 10^{-67} \lor \neg \left(y \leq 1.25 \cdot 10^{-75}\right):\\
\;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.64999999999999986e-67 or 1.24999999999999995e-75 < y

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.64999999999999986e-67 < y < 1.24999999999999995e-75

    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 b around inf 86.3%

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

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

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

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

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

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

Alternative 10: 26.8% accurate, 19.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-67}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{-64}:\\
\;\;\;\;x\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot \left(a \cdot b\right)\right)} \cdot x + 0 \]
      6. mul0-lft20.8%

        \[\leadsto \left(-1 \cdot \left(a \cdot b\right)\right) \cdot x + \color{blue}{0 \cdot x} \]
      7. distribute-rgt-in20.8%

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

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

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

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

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

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

    if -3.3000000000000002e-67 < y < 1.84999999999999999e-64

    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 b around inf 86.3%

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

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

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

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

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

    if 1.84999999999999999e-64 < y

    1. Initial program 94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 21.6% accurate, 19.6× speedup?

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

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

\mathbf{elif}\;x \leq 2 \cdot 10^{+158}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 5.00000000000000019e-43

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{-a \cdot z}} \]
      2. *-commutative32.5%

        \[\leadsto x \cdot e^{-\color{blue}{z \cdot a}} \]
      3. distribute-rgt-neg-in32.5%

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000019e-43 < x < 1.99999999999999991e158

    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. Add Preprocessing
    3. Taylor expanded in b around inf 60.2%

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

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

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

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

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

    if 1.99999999999999991e158 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot \left(a \cdot b\right)\right)} \cdot x + 0 \]
      6. mul0-lft26.4%

        \[\leadsto \left(-1 \cdot \left(a \cdot b\right)\right) \cdot x + \color{blue}{0 \cdot x} \]
      7. distribute-rgt-in26.4%

        \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(a \cdot b\right) + 0\right)} \]
      8. add026.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5 \cdot 10^{-43}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\ \mathbf{elif}\;x \leq 2 \cdot 10^{+158}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-a \cdot b\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 24.3% accurate, 26.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-29}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\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 x < 6.9999999999999995e-29

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot e^{\color{blue}{-a \cdot z}} \]
      2. *-commutative32.7%

        \[\leadsto x \cdot e^{-\color{blue}{z \cdot a}} \]
      3. distribute-rgt-neg-in32.7%

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

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

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

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

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

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

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

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

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

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

    if 6.9999999999999995e-29 < x

    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 b around inf 56.0%

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

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

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

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

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

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

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

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

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

Alternative 13: 2.7% accurate, 315.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x y z t a b) :precision binary64 1.0)
double code(double x, double y, double z, double t, double a, double b) {
	return 1.0;
}
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 = 1.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return 1.0;
}
def code(x, y, z, t, a, b):
	return 1.0
function code(x, y, z, t, a, b)
	return 1.0
end
function tmp = code(x, y, z, t, a, b)
	tmp = 1.0;
end
code[x_, y_, z_, t_, a_, b_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  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. Add Preprocessing
  3. Step-by-step derivation
    1. add-exp-log68.0%

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right) + \log x}} \]
  5. Step-by-step derivation
    1. add-cube-cbrt42.8%

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

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

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

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

    \[\leadsto \color{blue}{{\left(e^{\sqrt[3]{{\left(\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right) + \log x\right)}^{2}}}\right)}^{\left(\sqrt[3]{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right) + \log x}\right)}} \]
  7. Taylor expanded in y around inf 2.7%

    \[\leadsto \color{blue}{1} \]
  8. Final simplification2.7%

    \[\leadsto 1 \]
  9. Add Preprocessing

Alternative 14: 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 97.4%

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  7. Final simplification17.2%

    \[\leadsto x \]
  8. Add Preprocessing

Reproduce

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