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

Percentage Accurate: 96.6% → 99.2%
Time: 16.4s
Alternatives: 16
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 96.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.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 100.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. associate-*r*100.0%

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

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

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

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

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

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

Alternative 2: 86.1% accurate, 1.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.8e15 or 1.18e-55 < y

    1. Initial program 100.0%

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

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

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

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

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

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

    if -1.8e15 < y < 1.18e-55

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 74.0% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+75} \lor \neg \left(t \leq 6.5 \cdot 10^{-79}\right):\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.40000000000000024e75 or 6.5000000000000003e-79 < t

    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. 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-define100.0%

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

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

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

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

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

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

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

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

    if -4.40000000000000024e75 < t < 6.5000000000000003e-79

    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 100.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. associate-*r*100.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 71.6% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{+74} \lor \neg \left(t \leq 5.8 \cdot 10^{-79}\right):\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.80000000000000015e74 or 5.8000000000000001e-79 < t

    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. 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-define100.0%

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

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

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

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

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

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

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

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

    if -7.80000000000000015e74 < t < 5.8000000000000001e-79

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

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

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

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

      \[\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 y around 0 67.5%

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

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

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

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

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

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

Alternative 5: 71.1% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -13500000000 \lor \neg \left(t \leq 4 \cdot 10^{-151}\right):\\
\;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.35e10 or 3.9999999999999998e-151 < t

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

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

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

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

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

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

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

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

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

    if -1.35e10 < t < 3.9999999999999998e-151

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -13500000000 \lor \neg \left(t \leq 4 \cdot 10^{-151}\right):\\ \;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 58.4% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.1 \cdot 10^{+192} \lor \neg \left(a \leq 2.8 \cdot 10^{+30}\right):\\
\;\;\;\;x \cdot {\left(-z\right)}^{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.10000000000000003e192 or 2.79999999999999983e30 < a

    1. Initial program 93.4%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Step-by-step derivation
      1. fma-define93.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-neg93.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-define100.0%

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

      \[\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 y around 0 70.3%

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

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

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

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

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

    if -4.10000000000000003e192 < a < 2.79999999999999983e30

    1. Initial program 98.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-define98.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-neg98.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-define100.0%

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

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

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

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

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

Alternative 7: 55.4% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+259}:\\
\;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\

\mathbf{elif}\;t \leq -4000000000000:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.8000000000000001e259

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

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

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

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

      \[\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 y around 0 38.4%

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

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

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

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

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

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

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

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

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

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

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

    if -2.8000000000000001e259 < t < -4e12

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in43.8%

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

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

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

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

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

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

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

    if -4e12 < t

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

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

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

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

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

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

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

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

Alternative 8: 31.1% accurate, 14.3× speedup?

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

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

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

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


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

    1. Initial program 91.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-define91.9%

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

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

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

      \[\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 y around 0 67.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1.34999999999999997e155 < a < 1.8e28

    1. Initial program 99.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-define99.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-neg99.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-define100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in37.8%

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

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

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

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

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

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

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

    if 1.8e28 < a

    1. Initial program 93.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-define93.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-neg93.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-define100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(-y \cdot t\right)} \]
      5. distribute-rgt-neg-in34.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.35 \cdot 10^{+155}:\\ \;\;\;\;x \cdot \frac{1 - \left(z \cdot a\right) \cdot \left(z \cdot a\right)}{z \cdot a + 1}\\ \mathbf{elif}\;a \leq 1.8 \cdot 10^{+28}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t \cdot \left(-y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 31.3% accurate, 18.5× speedup?

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

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

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

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


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

    1. Initial program 91.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-define91.9%

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

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

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

      \[\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 y around 0 67.5%

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

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

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

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

        \[\leadsto x + \left(a \cdot x\right) \cdot \left(\color{blue}{\mathsf{log1p}\left(-z\right)} - b\right) \]
    8. Simplified33.0%

      \[\leadsto \color{blue}{x + \left(a \cdot x\right) \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)} \]
    9. Taylor expanded in z around 0 24.6%

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{\left(x \cdot a\right) \cdot \left(-b\right)} \]
      7. associate-*l*35.0%

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

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

    if -2.00000000000000001e155 < a < 5.6000000000000003e24

    1. Initial program 99.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-define99.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-neg99.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-define100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in37.8%

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

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

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

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

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

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

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

    if 5.6000000000000003e24 < a

    1. Initial program 93.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-define93.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-neg93.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-define100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(-y \cdot t\right)} \]
      5. distribute-rgt-neg-in34.1%

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

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

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

Alternative 10: 31.0% accurate, 18.5× speedup?

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

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

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

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


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

    1. Initial program 91.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-define91.9%

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

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

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

      \[\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 y around 0 67.5%

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

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

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

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

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

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

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

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

    if -8.00000000000000006e155 < a < 2.80000000000000017e31

    1. Initial program 99.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-define99.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-neg99.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-define100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in37.8%

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

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

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

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

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

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

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

    if 2.80000000000000017e31 < a

    1. Initial program 93.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-define93.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-neg93.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-define100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(-y \cdot t\right)} \]
      5. distribute-rgt-neg-in34.1%

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

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

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

Alternative 11: 29.0% accurate, 18.5× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in24.7%

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

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

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

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

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

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

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

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

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

    if -3.99999999999999963e-21 < y < 5.7999999999999998e-87

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in36.4%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(0 + \left(-y\right)\right)} \cdot t\right) \]
      3. add-sqr-sqrt20.3%

        \[\leadsto x \cdot \left(1 + \left(0 + \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \cdot t\right) \]
      4. sqrt-unprod36.4%

        \[\leadsto x \cdot \left(1 + \left(0 + \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}}\right) \cdot t\right) \]
      5. sqr-neg36.4%

        \[\leadsto x \cdot \left(1 + \left(0 + \sqrt{\color{blue}{y \cdot y}}\right) \cdot t\right) \]
      6. sqrt-unprod16.0%

        \[\leadsto x \cdot \left(1 + \left(0 + \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \cdot t\right) \]
      7. add-sqr-sqrt37.0%

        \[\leadsto x \cdot \left(1 + \left(0 + \color{blue}{y}\right) \cdot t\right) \]
    13. Applied egg-rr37.0%

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

        \[\leadsto x \cdot \left(1 + \color{blue}{y} \cdot t\right) \]
    15. Simplified37.0%

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

    if 5.7999999999999998e-87 < y

    1. Initial program 99.0%

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

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

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

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

      \[\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 y around 0 36.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4 \cdot 10^{-21}:\\ \;\;\;\;x \cdot \left(t \cdot \left(-y\right)\right)\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{-87}:\\ \;\;\;\;x \cdot \left(y \cdot t + 1\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-z\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 28.1% accurate, 19.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-46} \lor \neg \left(y \leq 5 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \left(t \cdot \left(-y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.09999999999999987e-46 or 5.00000000000000041e-6 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in22.2%

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

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

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

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

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

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

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

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

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

    if -2.09999999999999987e-46 < y < 5.00000000000000041e-6

    1. Initial program 92.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-define92.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-46} \lor \neg \left(y \leq 5 \cdot 10^{-6}\right):\\ \;\;\;\;x \cdot \left(t \cdot \left(-y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 29.0% accurate, 19.6× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.09999999999999987e-46 < y < 1.84999999999999993e-81

    1. Initial program 92.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-define92.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-neg92.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-define100.0%

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

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

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

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

    if 1.84999999999999993e-81 < y

    1. Initial program 99.0%

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

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

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

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

      \[\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 y around 0 36.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 29.2% accurate, 19.6× speedup?

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

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

\mathbf{elif}\;y \leq 1.56 \cdot 10^{-56}:\\
\;\;\;\;x\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.09999999999999987e-46 < y < 1.56000000000000003e-56

    1. Initial program 92.7%

      \[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-define92.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-neg92.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-define100.0%

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

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

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

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

    if 1.56000000000000003e-56 < y

    1. Initial program 98.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-define98.9%

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

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

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

      \[\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 y around 0 33.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 23.4% accurate, 26.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 6.7999999999999997e-41

    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.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-define100.0%

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

      \[\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 y around 0 54.0%

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

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

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

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

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

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

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

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

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

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

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

    if 6.7999999999999997e-41 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(1 + \left(-\color{blue}{y \cdot t}\right)\right) \]
      3. distribute-lft-neg-in26.8%

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

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

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

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

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

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

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

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

Alternative 16: 20.0% 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-define96.9%

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

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

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

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

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

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

Reproduce

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