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

Percentage Accurate: 96.5% → 96.5%
Time: 12.4s
Alternatives: 9
Speedup: N/A×

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 9 alternatives:

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

Initial Program: 96.5% accurate, 1.0× speedup?

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

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

Alternative 1: 96.5% accurate, 1.5× speedup?

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

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

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

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

      \[\leadsto x \cdot e^{\color{blue}{\mathsf{fma}\left(-1 \cdot a, b, y \cdot \left(\log z - t\right)\right)}} \]
    3. mul-1-negN/A

      \[\leadsto x \cdot e^{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(a\right)}, b, y \cdot \left(\log z - t\right)\right)} \]
    4. lower-neg.f64N/A

      \[\leadsto x \cdot e^{\mathsf{fma}\left(\color{blue}{-a}, b, y \cdot \left(\log z - t\right)\right)} \]
    5. *-commutativeN/A

      \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \color{blue}{\left(\log z - t\right) \cdot y}\right)} \]
    6. lower-*.f64N/A

      \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \color{blue}{\left(\log z - t\right) \cdot y}\right)} \]
    7. lower--.f64N/A

      \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \color{blue}{\left(\log z - t\right)} \cdot y\right)} \]
    8. lower-log.f6496.2

      \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \left(\color{blue}{\log z} - t\right) \cdot y\right)} \]
  5. Applied rewrites96.2%

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

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

Alternative 2: 44.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y \leq -1 \cdot 10^{-8}:\\ \;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(t \cdot t\right) \cdot y\right) \cdot 0.5\right) \cdot y, x, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (if (<= (+ (* (- (log (- 1.0 z)) b) a) (* (- (log z) t) y)) -1e-8)
   (* (* (* y y) x) (* (* t t) 0.5))
   (fma (* (* (* (* t t) y) 0.5) y) x x)))
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((((log((1.0 - z)) - b) * a) + ((log(z) - t) * y)) <= -1e-8) {
		tmp = ((y * y) * x) * ((t * t) * 0.5);
	} else {
		tmp = fma(((((t * t) * y) * 0.5) * y), x, x);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) + Float64(Float64(log(z) - t) * y)) <= -1e-8)
		tmp = Float64(Float64(Float64(y * y) * x) * Float64(Float64(t * t) * 0.5));
	else
		tmp = fma(Float64(Float64(Float64(Float64(t * t) * y) * 0.5) * y), x, x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], -1e-8], N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(t * t), $MachinePrecision] * y), $MachinePrecision] * 0.5), $MachinePrecision] * y), $MachinePrecision] * x + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y \leq -1 \cdot 10^{-8}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(t \cdot t\right) \cdot y\right) \cdot 0.5\right) \cdot y, x, x\right)\\


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

    1. Initial program 97.3%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \left({\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot \mathsf{fma}\left(0.5 \cdot y, {\left(\log z - t\right)}^{2}, \log z - t\right)\right), y, {\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot x\right)} \]
    5. Taylor expanded in a around 0

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

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

        \[\leadsto \frac{1}{2} \cdot \left({t}^{2} \cdot \color{blue}{\left(x \cdot {y}^{2}\right)}\right) \]
      3. Step-by-step derivation
        1. Applied rewrites30.0%

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

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

        1. Initial program 95.4%

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \left({\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot \mathsf{fma}\left(0.5 \cdot y, {\left(\log z - t\right)}^{2}, \log z - t\right)\right), y, {\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot x\right)} \]
        5. Taylor expanded in a around 0

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

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

            \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} \cdot \left({t}^{2} \cdot y\right)\right) \cdot y, x, x\right) \]
          3. Step-by-step derivation
            1. Applied rewrites59.6%

              \[\leadsto \mathsf{fma}\left(\left(\left(\left(t \cdot t\right) \cdot y\right) \cdot 0.5\right) \cdot y, x, x\right) \]
          4. Recombined 2 regimes into one program.
          5. Final simplification47.2%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y \leq -1 \cdot 10^{-8}:\\ \;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(t \cdot t\right) \cdot y\right) \cdot 0.5\right) \cdot y, x, x\right)\\ \end{array} \]
          6. Add Preprocessing

          Alternative 3: 88.5% accurate, 1.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\left(-t\right) \cdot y} \cdot x\\ \mathbf{if}\;t \leq -8 \cdot 10^{+21}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{+155}:\\ \;\;\;\;e^{\mathsf{fma}\left(-a, b, \log z \cdot y\right)} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (x y z t a b)
           :precision binary64
           (let* ((t_1 (* (exp (* (- t) y)) x)))
             (if (<= t -8e+21)
               t_1
               (if (<= t 1.15e+155) (* (exp (fma (- a) b (* (log z) y))) x) t_1))))
          double code(double x, double y, double z, double t, double a, double b) {
          	double t_1 = exp((-t * y)) * x;
          	double tmp;
          	if (t <= -8e+21) {
          		tmp = t_1;
          	} else if (t <= 1.15e+155) {
          		tmp = exp(fma(-a, b, (log(z) * y))) * x;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          function code(x, y, z, t, a, b)
          	t_1 = Float64(exp(Float64(Float64(-t) * y)) * x)
          	tmp = 0.0
          	if (t <= -8e+21)
          		tmp = t_1;
          	elseif (t <= 1.15e+155)
          		tmp = Float64(exp(fma(Float64(-a), b, Float64(log(z) * y))) * x);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -8e+21], t$95$1, If[LessEqual[t, 1.15e+155], N[(N[Exp[N[((-a) * b + N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := e^{\left(-t\right) \cdot y} \cdot x\\
          \mathbf{if}\;t \leq -8 \cdot 10^{+21}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t \leq 1.15 \cdot 10^{+155}:\\
          \;\;\;\;e^{\mathsf{fma}\left(-a, b, \log z \cdot y\right)} \cdot x\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if t < -8e21 or 1.14999999999999999e155 < t

            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 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.f6482.0

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

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

            if -8e21 < t < 1.14999999999999999e155

            1. Initial program 97.0%

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

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

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

                \[\leadsto x \cdot e^{\color{blue}{\mathsf{fma}\left(-1 \cdot a, b, y \cdot \left(\log z - t\right)\right)}} \]
              3. mul-1-negN/A

                \[\leadsto x \cdot e^{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(a\right)}, b, y \cdot \left(\log z - t\right)\right)} \]
              4. lower-neg.f64N/A

                \[\leadsto x \cdot e^{\mathsf{fma}\left(\color{blue}{-a}, b, y \cdot \left(\log z - t\right)\right)} \]
              5. *-commutativeN/A

                \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \color{blue}{\left(\log z - t\right) \cdot y}\right)} \]
              6. lower-*.f64N/A

                \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \color{blue}{\left(\log z - t\right) \cdot y}\right)} \]
              7. lower--.f64N/A

                \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \color{blue}{\left(\log z - t\right)} \cdot y\right)} \]
              8. lower-log.f6495.9

                \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \left(\color{blue}{\log z} - t\right) \cdot y\right)} \]
            5. Applied rewrites95.9%

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

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

                \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \log z \cdot y\right)} \]
            8. Recombined 2 regimes into one program.
            9. Final simplification90.5%

              \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8 \cdot 10^{+21}:\\ \;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{+155}:\\ \;\;\;\;e^{\mathsf{fma}\left(-a, b, \log z \cdot y\right)} \cdot x\\ \mathbf{else}:\\ \;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\ \end{array} \]
            10. Add Preprocessing

            Alternative 4: 87.0% accurate, 1.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\ \mathbf{if}\;y \leq -140:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-47}:\\ \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
            (FPCore (x y z t a b)
             :precision binary64
             (let* ((t_1 (* (exp (* (- (log z) t) y)) x)))
               (if (<= y -140.0)
                 t_1
                 (if (<= y 4.2e-47) (* (exp (* (- (- z) b) a)) x) t_1))))
            double code(double x, double y, double z, double t, double a, double b) {
            	double t_1 = exp(((log(z) - t) * y)) * x;
            	double tmp;
            	if (y <= -140.0) {
            		tmp = t_1;
            	} else if (y <= 4.2e-47) {
            		tmp = exp(((-z - b) * a)) * x;
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            real(8) function code(x, y, z, t, a, b)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8), intent (in) :: t
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8) :: t_1
                real(8) :: tmp
                t_1 = exp(((log(z) - t) * y)) * x
                if (y <= (-140.0d0)) then
                    tmp = t_1
                else if (y <= 4.2d-47) then
                    tmp = exp(((-z - b) * a)) * x
                else
                    tmp = t_1
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z, double t, double a, double b) {
            	double t_1 = Math.exp(((Math.log(z) - t) * y)) * x;
            	double tmp;
            	if (y <= -140.0) {
            		tmp = t_1;
            	} else if (y <= 4.2e-47) {
            		tmp = Math.exp(((-z - b) * a)) * x;
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a, b):
            	t_1 = math.exp(((math.log(z) - t) * y)) * x
            	tmp = 0
            	if y <= -140.0:
            		tmp = t_1
            	elif y <= 4.2e-47:
            		tmp = math.exp(((-z - b) * a)) * x
            	else:
            		tmp = t_1
            	return tmp
            
            function code(x, y, z, t, a, b)
            	t_1 = Float64(exp(Float64(Float64(log(z) - t) * y)) * x)
            	tmp = 0.0
            	if (y <= -140.0)
            		tmp = t_1;
            	elseif (y <= 4.2e-47)
            		tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x);
            	else
            		tmp = t_1;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t, a, b)
            	t_1 = exp(((log(z) - t) * y)) * x;
            	tmp = 0.0;
            	if (y <= -140.0)
            		tmp = t_1;
            	elseif (y <= 4.2e-47)
            		tmp = exp(((-z - b) * a)) * x;
            	else
            		tmp = t_1;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -140.0], t$95$1, If[LessEqual[y, 4.2e-47], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\
            \mathbf{if}\;y \leq -140:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;y \leq 4.2 \cdot 10^{-47}:\\
            \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -140 or 4.2000000000000001e-47 < y

              1. Initial program 96.0%

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

                \[\leadsto x \cdot e^{\color{blue}{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. lower-*.f64N/A

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

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

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

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

              if -140 < y < 4.2000000000000001e-47

              1. Initial program 96.3%

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

                \[\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.f6488.5

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -140:\\ \;\;\;\;e^{\left(\log z - t\right) \cdot y} \cdot x\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-47}:\\ \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\ \mathbf{else}:\\ \;\;\;\;e^{\left(\log z - t\right) \cdot y} \cdot x\\ \end{array} \]
              10. Add Preprocessing

              Alternative 5: 75.9% accurate, 1.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\log z \cdot y} \cdot x\\ \mathbf{if}\;y \leq -140:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+68}:\\ \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
              (FPCore (x y z t a b)
               :precision binary64
               (let* ((t_1 (* (exp (* (log z) y)) x)))
                 (if (<= y -140.0)
                   t_1
                   (if (<= y 2.7e+68) (* (exp (* (- (- z) b) a)) x) t_1))))
              double code(double x, double y, double z, double t, double a, double b) {
              	double t_1 = exp((log(z) * y)) * x;
              	double tmp;
              	if (y <= -140.0) {
              		tmp = t_1;
              	} else if (y <= 2.7e+68) {
              		tmp = exp(((-z - b) * a)) * x;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              real(8) function code(x, y, z, t, a, b)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8), intent (in) :: t
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  real(8) :: t_1
                  real(8) :: tmp
                  t_1 = exp((log(z) * y)) * x
                  if (y <= (-140.0d0)) then
                      tmp = t_1
                  else if (y <= 2.7d+68) then
                      tmp = exp(((-z - b) * a)) * x
                  else
                      tmp = t_1
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z, double t, double a, double b) {
              	double t_1 = Math.exp((Math.log(z) * y)) * x;
              	double tmp;
              	if (y <= -140.0) {
              		tmp = t_1;
              	} else if (y <= 2.7e+68) {
              		tmp = Math.exp(((-z - b) * a)) * x;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              def code(x, y, z, t, a, b):
              	t_1 = math.exp((math.log(z) * y)) * x
              	tmp = 0
              	if y <= -140.0:
              		tmp = t_1
              	elif y <= 2.7e+68:
              		tmp = math.exp(((-z - b) * a)) * x
              	else:
              		tmp = t_1
              	return tmp
              
              function code(x, y, z, t, a, b)
              	t_1 = Float64(exp(Float64(log(z) * y)) * x)
              	tmp = 0.0
              	if (y <= -140.0)
              		tmp = t_1;
              	elseif (y <= 2.7e+68)
              		tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x);
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z, t, a, b)
              	t_1 = exp((log(z) * y)) * x;
              	tmp = 0.0;
              	if (y <= -140.0)
              		tmp = t_1;
              	elseif (y <= 2.7e+68)
              		tmp = exp(((-z - b) * a)) * x;
              	else
              		tmp = t_1;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -140.0], t$95$1, If[LessEqual[y, 2.7e+68], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_1 := e^{\log z \cdot y} \cdot x\\
              \mathbf{if}\;y \leq -140:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;y \leq 2.7 \cdot 10^{+68}:\\
              \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -140 or 2.69999999999999991e68 < y

                1. Initial program 95.2%

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

                  \[\leadsto x \cdot e^{\color{blue}{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. lower-*.f64N/A

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

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

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

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

                  \[\leadsto x \cdot e^{\log z \cdot y} \]
                7. Step-by-step derivation
                  1. Applied rewrites75.6%

                    \[\leadsto x \cdot e^{\log z \cdot y} \]

                  if -140 < y < 2.69999999999999991e68

                  1. Initial program 97.0%

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

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

                      \[\leadsto x \cdot e^{\left(\mathsf{log1p}\left(\color{blue}{-z}\right) - b\right) \cdot a} \]
                  5. Applied rewrites82.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^{\left(-1 \cdot z - b\right) \cdot a} \]
                  7. Step-by-step derivation
                    1. Applied rewrites82.2%

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -140:\\ \;\;\;\;e^{\log z \cdot y} \cdot x\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+68}:\\ \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\ \mathbf{else}:\\ \;\;\;\;e^{\log z \cdot y} \cdot x\\ \end{array} \]
                  10. Add Preprocessing

                  Alternative 6: 72.9% accurate, 2.6× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\ \mathbf{if}\;a \leq -5.9 \cdot 10^{+82}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.05 \cdot 10^{+26}:\\ \;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                  (FPCore (x y z t a b)
                   :precision binary64
                   (let* ((t_1 (* (exp (* (- (- z) b) a)) x)))
                     (if (<= a -5.9e+82) t_1 (if (<= a 1.05e+26) (* (exp (* (- t) y)) x) t_1))))
                  double code(double x, double y, double z, double t, double a, double b) {
                  	double t_1 = exp(((-z - b) * a)) * x;
                  	double tmp;
                  	if (a <= -5.9e+82) {
                  		tmp = t_1;
                  	} else if (a <= 1.05e+26) {
                  		tmp = exp((-t * y)) * x;
                  	} else {
                  		tmp = t_1;
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(x, y, z, t, a, b)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8), intent (in) :: t
                      real(8), intent (in) :: a
                      real(8), intent (in) :: b
                      real(8) :: t_1
                      real(8) :: tmp
                      t_1 = exp(((-z - b) * a)) * x
                      if (a <= (-5.9d+82)) then
                          tmp = t_1
                      else if (a <= 1.05d+26) then
                          tmp = exp((-t * y)) * x
                      else
                          tmp = t_1
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z, double t, double a, double b) {
                  	double t_1 = Math.exp(((-z - b) * a)) * x;
                  	double tmp;
                  	if (a <= -5.9e+82) {
                  		tmp = t_1;
                  	} else if (a <= 1.05e+26) {
                  		tmp = Math.exp((-t * y)) * x;
                  	} else {
                  		tmp = t_1;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z, t, a, b):
                  	t_1 = math.exp(((-z - b) * a)) * x
                  	tmp = 0
                  	if a <= -5.9e+82:
                  		tmp = t_1
                  	elif a <= 1.05e+26:
                  		tmp = math.exp((-t * y)) * x
                  	else:
                  		tmp = t_1
                  	return tmp
                  
                  function code(x, y, z, t, a, b)
                  	t_1 = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x)
                  	tmp = 0.0
                  	if (a <= -5.9e+82)
                  		tmp = t_1;
                  	elseif (a <= 1.05e+26)
                  		tmp = Float64(exp(Float64(Float64(-t) * y)) * x);
                  	else
                  		tmp = t_1;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z, t, a, b)
                  	t_1 = exp(((-z - b) * a)) * x;
                  	tmp = 0.0;
                  	if (a <= -5.9e+82)
                  		tmp = t_1;
                  	elseif (a <= 1.05e+26)
                  		tmp = exp((-t * y)) * x;
                  	else
                  		tmp = t_1;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[a, -5.9e+82], t$95$1, If[LessEqual[a, 1.05e+26], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_1 := e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
                  \mathbf{if}\;a \leq -5.9 \cdot 10^{+82}:\\
                  \;\;\;\;t\_1\\
                  
                  \mathbf{elif}\;a \leq 1.05 \cdot 10^{+26}:\\
                  \;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_1\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if a < -5.8999999999999997e82 or 1.05e26 < a

                    1. Initial program 91.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 inf

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

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

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

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

                      if -5.8999999999999997e82 < a < 1.05e26

                      1. Initial program 100.0%

                        \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
                      2. Add Preprocessing
                      3. Taylor expanded in 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.f6469.0

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.9 \cdot 10^{+82}:\\ \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\ \mathbf{elif}\;a \leq 1.05 \cdot 10^{+26}:\\ \;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 7: 71.0% accurate, 2.6× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\left(-b\right) \cdot a} \cdot x\\ \mathbf{if}\;b \leq -1.9 \cdot 10^{+48}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 10^{-40}:\\ \;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                    (FPCore (x y z t a b)
                     :precision binary64
                     (let* ((t_1 (* (exp (* (- b) a)) x)))
                       (if (<= b -1.9e+48) t_1 (if (<= b 1e-40) (* (exp (* (- t) y)) x) t_1))))
                    double code(double x, double y, double z, double t, double a, double b) {
                    	double t_1 = exp((-b * a)) * x;
                    	double tmp;
                    	if (b <= -1.9e+48) {
                    		tmp = t_1;
                    	} else if (b <= 1e-40) {
                    		tmp = exp((-t * y)) * x;
                    	} else {
                    		tmp = t_1;
                    	}
                    	return tmp;
                    }
                    
                    real(8) function code(x, y, z, t, a, b)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        real(8), intent (in) :: t
                        real(8), intent (in) :: a
                        real(8), intent (in) :: b
                        real(8) :: t_1
                        real(8) :: tmp
                        t_1 = exp((-b * a)) * x
                        if (b <= (-1.9d+48)) then
                            tmp = t_1
                        else if (b <= 1d-40) then
                            tmp = exp((-t * y)) * x
                        else
                            tmp = t_1
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z, double t, double a, double b) {
                    	double t_1 = Math.exp((-b * a)) * x;
                    	double tmp;
                    	if (b <= -1.9e+48) {
                    		tmp = t_1;
                    	} else if (b <= 1e-40) {
                    		tmp = Math.exp((-t * y)) * x;
                    	} else {
                    		tmp = t_1;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z, t, a, b):
                    	t_1 = math.exp((-b * a)) * x
                    	tmp = 0
                    	if b <= -1.9e+48:
                    		tmp = t_1
                    	elif b <= 1e-40:
                    		tmp = math.exp((-t * y)) * x
                    	else:
                    		tmp = t_1
                    	return tmp
                    
                    function code(x, y, z, t, a, b)
                    	t_1 = Float64(exp(Float64(Float64(-b) * a)) * x)
                    	tmp = 0.0
                    	if (b <= -1.9e+48)
                    		tmp = t_1;
                    	elseif (b <= 1e-40)
                    		tmp = Float64(exp(Float64(Float64(-t) * y)) * x);
                    	else
                    		tmp = t_1;
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z, t, a, b)
                    	t_1 = exp((-b * a)) * x;
                    	tmp = 0.0;
                    	if (b <= -1.9e+48)
                    		tmp = t_1;
                    	elseif (b <= 1e-40)
                    		tmp = exp((-t * y)) * x;
                    	else
                    		tmp = t_1;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, -1.9e+48], t$95$1, If[LessEqual[b, 1e-40], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    t_1 := e^{\left(-b\right) \cdot a} \cdot x\\
                    \mathbf{if}\;b \leq -1.9 \cdot 10^{+48}:\\
                    \;\;\;\;t\_1\\
                    
                    \mathbf{elif}\;b \leq 10^{-40}:\\
                    \;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_1\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if b < -1.9e48 or 9.9999999999999993e-41 < b

                      1. Initial program 95.5%

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

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

                          \[\leadsto x \cdot e^{\color{blue}{\mathsf{neg}\left(a \cdot b\right)}} \]
                        2. *-commutativeN/A

                          \[\leadsto x \cdot e^{\mathsf{neg}\left(\color{blue}{b \cdot a}\right)} \]
                        3. distribute-lft-neg-inN/A

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

                          \[\leadsto x \cdot e^{\color{blue}{\left(\mathsf{neg}\left(b\right)\right) \cdot a}} \]
                        5. lower-neg.f6477.1

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

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

                      if -1.9e48 < b < 9.9999999999999993e-41

                      1. Initial program 96.6%

                        \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
                      2. 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.f6467.5

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

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

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

                    Alternative 8: 60.6% accurate, 2.8× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+123}:\\ \;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\left(-b\right) \cdot a} \cdot x\\ \end{array} \end{array} \]
                    (FPCore (x y z t a b)
                     :precision binary64
                     (if (<= y -1.5e+123)
                       (* (* (* y y) x) (* (* t t) 0.5))
                       (* (exp (* (- b) a)) x)))
                    double code(double x, double y, double z, double t, double a, double b) {
                    	double tmp;
                    	if (y <= -1.5e+123) {
                    		tmp = ((y * y) * x) * ((t * t) * 0.5);
                    	} else {
                    		tmp = exp((-b * a)) * x;
                    	}
                    	return tmp;
                    }
                    
                    real(8) function code(x, y, z, t, a, b)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        real(8), intent (in) :: t
                        real(8), intent (in) :: a
                        real(8), intent (in) :: b
                        real(8) :: tmp
                        if (y <= (-1.5d+123)) then
                            tmp = ((y * y) * x) * ((t * t) * 0.5d0)
                        else
                            tmp = exp((-b * a)) * x
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z, double t, double a, double b) {
                    	double tmp;
                    	if (y <= -1.5e+123) {
                    		tmp = ((y * y) * x) * ((t * t) * 0.5);
                    	} else {
                    		tmp = Math.exp((-b * a)) * x;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z, t, a, b):
                    	tmp = 0
                    	if y <= -1.5e+123:
                    		tmp = ((y * y) * x) * ((t * t) * 0.5)
                    	else:
                    		tmp = math.exp((-b * a)) * x
                    	return tmp
                    
                    function code(x, y, z, t, a, b)
                    	tmp = 0.0
                    	if (y <= -1.5e+123)
                    		tmp = Float64(Float64(Float64(y * y) * x) * Float64(Float64(t * t) * 0.5));
                    	else
                    		tmp = Float64(exp(Float64(Float64(-b) * a)) * x);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z, t, a, b)
                    	tmp = 0.0;
                    	if (y <= -1.5e+123)
                    		tmp = ((y * y) * x) * ((t * t) * 0.5);
                    	else
                    		tmp = exp((-b * a)) * x;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.5e+123], N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;y \leq -1.5 \cdot 10^{+123}:\\
                    \;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;e^{\left(-b\right) \cdot a} \cdot x\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if y < -1.50000000000000004e123

                      1. Initial program 89.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 \color{blue}{x \cdot e^{a \cdot \left(\log \left(1 - z\right) - b\right)} + y \cdot \left(\frac{1}{2} \cdot \left(x \cdot \left(y \cdot \left(e^{a \cdot \left(\log \left(1 - z\right) - b\right)} \cdot {\left(\log z - t\right)}^{2}\right)\right)\right) + x \cdot \left(e^{a \cdot \left(\log \left(1 - z\right) - b\right)} \cdot \left(\log z - t\right)\right)\right)} \]
                      4. Applied rewrites60.1%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \left({\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot \mathsf{fma}\left(0.5 \cdot y, {\left(\log z - t\right)}^{2}, \log z - t\right)\right), y, {\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot x\right)} \]
                      5. Taylor expanded in a around 0

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

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

                          \[\leadsto \frac{1}{2} \cdot \left({t}^{2} \cdot \color{blue}{\left(x \cdot {y}^{2}\right)}\right) \]
                        3. Step-by-step derivation
                          1. Applied rewrites59.8%

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

                          if -1.50000000000000004e123 < y

                          1. Initial program 97.3%

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

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

                              \[\leadsto x \cdot e^{\color{blue}{\mathsf{neg}\left(a \cdot b\right)}} \]
                            2. *-commutativeN/A

                              \[\leadsto x \cdot e^{\mathsf{neg}\left(\color{blue}{b \cdot a}\right)} \]
                            3. distribute-lft-neg-inN/A

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

                              \[\leadsto x \cdot e^{\color{blue}{\left(\mathsf{neg}\left(b\right)\right) \cdot a}} \]
                            5. lower-neg.f6459.7

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

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+123}:\\ \;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\left(-b\right) \cdot a} \cdot x\\ \end{array} \]
                        6. Add Preprocessing

                        Alternative 9: 29.6% accurate, 12.6× speedup?

                        \[\begin{array}{l} \\ \left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right) \end{array} \]
                        (FPCore (x y z t a b) :precision binary64 (* (* (* y y) x) (* (* t t) 0.5)))
                        double code(double x, double y, double z, double t, double a, double b) {
                        	return ((y * y) * x) * ((t * t) * 0.5);
                        }
                        
                        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 = ((y * y) * x) * ((t * t) * 0.5d0)
                        end function
                        
                        public static double code(double x, double y, double z, double t, double a, double b) {
                        	return ((y * y) * x) * ((t * t) * 0.5);
                        }
                        
                        def code(x, y, z, t, a, b):
                        	return ((y * y) * x) * ((t * t) * 0.5)
                        
                        function code(x, y, z, t, a, b)
                        	return Float64(Float64(Float64(y * y) * x) * Float64(Float64(t * t) * 0.5))
                        end
                        
                        function tmp = code(x, y, z, t, a, b)
                        	tmp = ((y * y) * x) * ((t * t) * 0.5);
                        end
                        
                        code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]
                        
                        \begin{array}{l}
                        
                        \\
                        \left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)
                        \end{array}
                        
                        Derivation
                        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 y around 0

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \left({\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot \mathsf{fma}\left(0.5 \cdot y, {\left(\log z - t\right)}^{2}, \log z - t\right)\right), y, {\left(\frac{1 - z}{e^{b}}\right)}^{a} \cdot x\right)} \]
                        5. Taylor expanded in a around 0

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

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

                            \[\leadsto \frac{1}{2} \cdot \left({t}^{2} \cdot \color{blue}{\left(x \cdot {y}^{2}\right)}\right) \]
                          3. Step-by-step derivation
                            1. Applied rewrites30.9%

                              \[\leadsto \left(0.5 \cdot \left(t \cdot t\right)\right) \cdot \left(\left(y \cdot y\right) \cdot \color{blue}{x}\right) \]
                            2. Final simplification30.9%

                              \[\leadsto \left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right) \]
                            3. Add Preprocessing

                            Reproduce

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