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

Percentage Accurate: 96.6% → 96.6%
Time: 10.6s
Alternatives: 8
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 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: 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}
Derivation
  1. Initial program 93.9%

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

Alternative 2: 32.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\\
\mathbf{if}\;t\_1 \leq 0 \lor \neg \left(t\_1 \leq 1\right):\\
\;\;\;\;x \cdot \left(\left(-t\right) \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b)))) < 0.0 or 1 < (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))

    1. Initial program 95.8%

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

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

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

        \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
      3. lower-pow.f64N/A

        \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
      4. exp-diffN/A

        \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
      5. rem-exp-logN/A

        \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
      6. lower-/.f64N/A

        \[\leadsto x \cdot {\color{blue}{\left(\frac{z}{e^{t}}\right)}}^{y} \]
      7. lower-exp.f6473.2

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-t, \color{blue}{{z}^{y} \cdot y}, {z}^{y}\right) \]
      2. Taylor expanded in y around 0

        \[\leadsto x \cdot \left(1 + y \cdot \color{blue}{\left(\log z + -1 \cdot t\right)}\right) \]
      3. Step-by-step derivation
        1. Applied rewrites14.7%

          \[\leadsto x \cdot \mathsf{fma}\left(\log z - t, y, 1\right) \]
        2. Taylor expanded in t around inf

          \[\leadsto x \cdot \left(-1 \cdot \left(t \cdot y\right)\right) \]
        3. Step-by-step derivation
          1. Applied rewrites16.4%

            \[\leadsto x \cdot \left(\left(-t\right) \cdot y\right) \]

          if 0.0 < (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b)))) < 1

          1. Initial program 85.2%

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

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

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

              \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
            3. lower-pow.f64N/A

              \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
            4. exp-diffN/A

              \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
            5. rem-exp-logN/A

              \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
            6. lower-/.f64N/A

              \[\leadsto x \cdot {\color{blue}{\left(\frac{z}{e^{t}}\right)}}^{y} \]
            7. lower-exp.f6462.0

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

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

            \[\leadsto x \cdot {z}^{\color{blue}{y}} \]
          7. Step-by-step derivation
            1. Applied rewrites84.4%

              \[\leadsto x \cdot {z}^{\color{blue}{y}} \]
            2. Taylor expanded in y around 0

              \[\leadsto x \cdot 1 \]
            3. Step-by-step derivation
              1. Applied rewrites83.8%

                \[\leadsto x \cdot 1 \]
            4. Recombined 2 regimes into one program.
            5. Final simplification28.5%

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

            Alternative 3: 86.4% accurate, 1.4× speedup?

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

              1. Initial program 94.6%

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

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

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

                  \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                3. lower-pow.f64N/A

                  \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                4. exp-diffN/A

                  \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
                5. rem-exp-logN/A

                  \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
                6. lower-/.f64N/A

                  \[\leadsto x \cdot {\color{blue}{\left(\frac{z}{e^{t}}\right)}}^{y} \]
                7. lower-exp.f6488.1

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

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

              if -6.60000000000000007e-107 < y < 2.7499999999999998e-9

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

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

                  \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                2. lower-*.f64N/A

                  \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                3. lower--.f64N/A

                  \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right)} \cdot a} \]
                4. sub-negN/A

                  \[\leadsto x \cdot e^{\left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} - b\right) \cdot a} \]
                5. lower-log1p.f64N/A

                  \[\leadsto x \cdot e^{\left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(z\right)\right)} - b\right) \cdot a} \]
                6. lower-neg.f6489.3

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

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

                \[\leadsto x \cdot e^{\left(-1 \cdot z - b\right) \cdot a} \]
              7. Step-by-step derivation
                1. Applied rewrites89.3%

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

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

              Alternative 4: 74.0% accurate, 2.6× speedup?

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

                1. Initial program 94.7%

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

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

                    \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot t\right) \cdot y}} \]
                  2. mul-1-negN/A

                    \[\leadsto x \cdot e^{\color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot y} \]
                  3. lower-*.f64N/A

                    \[\leadsto x \cdot e^{\color{blue}{\left(\mathsf{neg}\left(t\right)\right) \cdot y}} \]
                  4. lower-neg.f6484.5

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

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

                if -1.8499999999999999e25 < t < 5.1000000000000002e22

                1. Initial program 93.2%

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

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

                    \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                  2. lower-*.f64N/A

                    \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                  3. lower--.f64N/A

                    \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right)} \cdot a} \]
                  4. sub-negN/A

                    \[\leadsto x \cdot e^{\left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} - b\right) \cdot a} \]
                  5. lower-log1p.f64N/A

                    \[\leadsto x \cdot e^{\left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(z\right)\right)} - b\right) \cdot a} \]
                  6. lower-neg.f6475.4

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

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

                  \[\leadsto x \cdot e^{\left(-1 \cdot z - b\right) \cdot a} \]
                7. Step-by-step derivation
                  1. Applied rewrites75.4%

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

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

                Alternative 5: 71.3% accurate, 2.6× speedup?

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

                  1. Initial program 94.7%

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

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

                      \[\leadsto x \cdot e^{\color{blue}{\left(-1 \cdot t\right) \cdot y}} \]
                    2. mul-1-negN/A

                      \[\leadsto x \cdot e^{\color{blue}{\left(\mathsf{neg}\left(t\right)\right)} \cdot y} \]
                    3. lower-*.f64N/A

                      \[\leadsto x \cdot e^{\color{blue}{\left(\mathsf{neg}\left(t\right)\right) \cdot y}} \]
                    4. lower-neg.f6484.5

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

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

                  if -1.8499999999999999e25 < t < 5.1000000000000002e22

                  1. Initial program 93.2%

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

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

                      \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                    2. lower-*.f64N/A

                      \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                    3. lower--.f64N/A

                      \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right)} \cdot a} \]
                    4. sub-negN/A

                      \[\leadsto x \cdot e^{\left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} - b\right) \cdot a} \]
                    5. lower-log1p.f64N/A

                      \[\leadsto x \cdot e^{\left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(z\right)\right)} - b\right) \cdot a} \]
                    6. lower-neg.f6475.4

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

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

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

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

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

                  Alternative 6: 73.5% accurate, 2.6× speedup?

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

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

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

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

                        \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                      3. lower-pow.f64N/A

                        \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                      4. exp-diffN/A

                        \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
                      5. rem-exp-logN/A

                        \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
                      6. lower-/.f64N/A

                        \[\leadsto x \cdot {\color{blue}{\left(\frac{z}{e^{t}}\right)}}^{y} \]
                      7. lower-exp.f6493.5

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

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

                      \[\leadsto x \cdot {z}^{\color{blue}{y}} \]
                    7. Step-by-step derivation
                      1. Applied rewrites71.2%

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

                      if -1.55e73 < y < 145000

                      1. Initial program 94.2%

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

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

                          \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                        2. lower-*.f64N/A

                          \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right) \cdot a}} \]
                        3. lower--.f64N/A

                          \[\leadsto x \cdot e^{\color{blue}{\left(\log \left(1 - z\right) - b\right)} \cdot a} \]
                        4. sub-negN/A

                          \[\leadsto x \cdot e^{\left(\log \color{blue}{\left(1 + \left(\mathsf{neg}\left(z\right)\right)\right)} - b\right) \cdot a} \]
                        5. lower-log1p.f64N/A

                          \[\leadsto x \cdot e^{\left(\color{blue}{\mathsf{log1p}\left(\mathsf{neg}\left(z\right)\right)} - b\right) \cdot a} \]
                        6. lower-neg.f6481.2

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

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

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

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

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

                      Alternative 7: 53.5% accurate, 2.9× speedup?

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

                        1. Initial program 93.5%

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

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

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

                            \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                          3. lower-pow.f64N/A

                            \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                          4. exp-diffN/A

                            \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
                          5. rem-exp-logN/A

                            \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
                          6. lower-/.f64N/A

                            \[\leadsto x \cdot {\color{blue}{\left(\frac{z}{e^{t}}\right)}}^{y} \]
                          7. lower-exp.f6482.4

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

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

                          \[\leadsto x \cdot \left(-1 \cdot \left(t \cdot \left(y \cdot {z}^{y}\right)\right) + \color{blue}{{z}^{y}}\right) \]
                        7. Step-by-step derivation
                          1. Applied rewrites10.2%

                            \[\leadsto x \cdot \mathsf{fma}\left(-t, \color{blue}{{z}^{y} \cdot y}, {z}^{y}\right) \]
                          2. Taylor expanded in y around 0

                            \[\leadsto x \cdot \left(1 + y \cdot \color{blue}{\left(\log z + -1 \cdot t\right)}\right) \]
                          3. Step-by-step derivation
                            1. Applied rewrites25.2%

                              \[\leadsto x \cdot \mathsf{fma}\left(\log z - t, y, 1\right) \]
                            2. Taylor expanded in t around inf

                              \[\leadsto x \cdot \left(-1 \cdot \left(t \cdot y\right)\right) \]
                            3. Step-by-step derivation
                              1. Applied rewrites19.1%

                                \[\leadsto x \cdot \left(\left(-t\right) \cdot y\right) \]

                              if -6.3999999999999997e34 < t

                              1. Initial program 94.0%

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

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

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

                                  \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                                3. lower-pow.f64N/A

                                  \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                                4. exp-diffN/A

                                  \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
                                5. rem-exp-logN/A

                                  \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
                                6. lower-/.f64N/A

                                  \[\leadsto x \cdot {\color{blue}{\left(\frac{z}{e^{t}}\right)}}^{y} \]
                                7. lower-exp.f6467.7

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

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

                                \[\leadsto x \cdot {z}^{\color{blue}{y}} \]
                              7. Step-by-step derivation
                                1. Applied rewrites60.6%

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

                              Alternative 8: 19.2% accurate, 54.7× speedup?

                              \[\begin{array}{l} \\ x \cdot 1 \end{array} \]
                              (FPCore (x y z t a b) :precision binary64 (* x 1.0))
                              double code(double x, double y, double z, double t, double a, double b) {
                              	return x * 1.0;
                              }
                              
                              real(8) function code(x, y, z, t, a, b)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  real(8), intent (in) :: z
                                  real(8), intent (in) :: t
                                  real(8), intent (in) :: a
                                  real(8), intent (in) :: b
                                  code = x * 1.0d0
                              end function
                              
                              public static double code(double x, double y, double z, double t, double a, double b) {
                              	return x * 1.0;
                              }
                              
                              def code(x, y, z, t, a, b):
                              	return x * 1.0
                              
                              function code(x, y, z, t, a, b)
                              	return Float64(x * 1.0)
                              end
                              
                              function tmp = code(x, y, z, t, a, b)
                              	tmp = x * 1.0;
                              end
                              
                              code[x_, y_, z_, t_, a_, b_] := N[(x * 1.0), $MachinePrecision]
                              
                              \begin{array}{l}
                              
                              \\
                              x \cdot 1
                              \end{array}
                              
                              Derivation
                              1. Initial program 93.9%

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

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

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

                                  \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                                3. lower-pow.f64N/A

                                  \[\leadsto x \cdot \color{blue}{{\left(e^{\log z - t}\right)}^{y}} \]
                                4. exp-diffN/A

                                  \[\leadsto x \cdot {\color{blue}{\left(\frac{e^{\log z}}{e^{t}}\right)}}^{y} \]
                                5. rem-exp-logN/A

                                  \[\leadsto x \cdot {\left(\frac{\color{blue}{z}}{e^{t}}\right)}^{y} \]
                                6. lower-/.f64N/A

                                  \[\leadsto x \cdot {\color{blue}{\left(\frac{z}{e^{t}}\right)}}^{y} \]
                                7. lower-exp.f6471.2

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

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

                                \[\leadsto x \cdot {z}^{\color{blue}{y}} \]
                              7. Step-by-step derivation
                                1. Applied rewrites48.7%

                                  \[\leadsto x \cdot {z}^{\color{blue}{y}} \]
                                2. Taylor expanded in y around 0

                                  \[\leadsto x \cdot 1 \]
                                3. Step-by-step derivation
                                  1. Applied rewrites18.3%

                                    \[\leadsto x \cdot 1 \]
                                  2. Add Preprocessing

                                  Reproduce

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