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

Percentage Accurate: 96.6% → 96.6%
Time: 9.4s
Alternatives: 9
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))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
    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.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))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
    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))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
    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 97.7%

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

Alternative 2: 95.9% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -400 \lor \neg \left(t \leq 10^{-97}\right):\\
\;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -400 or 1.00000000000000004e-97 < t

    1. Initial program 97.4%

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

      \[\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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)} \]

      if -400 < t < 1.00000000000000004e-97

      1. Initial program 98.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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 91.2% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -106000000000 \lor \neg \left(y \leq 3.65 \cdot 10^{-16}\right):\\ \;\;\;\;e^{\left(\log z - t\right) \cdot y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)}\\ \end{array} \end{array} \]
      (FPCore (x y z t a b)
       :precision binary64
       (if (or (<= y -106000000000.0) (not (<= y 3.65e-16)))
         (* (exp (* (- (log z) t) y)) x)
         (* x (exp (fma (- b) a (* (- t) y))))))
      double code(double x, double y, double z, double t, double a, double b) {
      	double tmp;
      	if ((y <= -106000000000.0) || !(y <= 3.65e-16)) {
      		tmp = exp(((log(z) - t) * y)) * x;
      	} else {
      		tmp = x * exp(fma(-b, a, (-t * y)));
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a, b)
      	tmp = 0.0
      	if ((y <= -106000000000.0) || !(y <= 3.65e-16))
      		tmp = Float64(exp(Float64(Float64(log(z) - t) * y)) * x);
      	else
      		tmp = Float64(x * exp(fma(Float64(-b), a, Float64(Float64(-t) * y))));
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -106000000000.0], N[Not[LessEqual[y, 3.65e-16]], $MachinePrecision]], N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], N[(x * N[Exp[N[((-b) * a + N[((-t) * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -106000000000 \lor \neg \left(y \leq 3.65 \cdot 10^{-16}\right):\\
      \;\;\;\;e^{\left(\log z - t\right) \cdot y} \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -1.06e11 or 3.6500000000000001e-16 < y

        1. Initial program 97.7%

          \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

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

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

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

            \[\leadsto x \cdot e^{\color{blue}{\frac{\log z \cdot \log z - t \cdot t}{\log z + t}} \cdot y + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
          5. associate-*l/N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(\frac{{\log z}^{2}}{t + \log z} - \frac{{t}^{2}}{t + \log z}\right)}} \]
        6. Step-by-step derivation
          1. div-subN/A

            \[\leadsto x \cdot e^{y \cdot \color{blue}{\frac{{\log z}^{2} - {t}^{2}}{t + \log z}}} \]
          2. associate-/l*N/A

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

            \[\leadsto x \cdot e^{\color{blue}{\frac{y \cdot \left({\log z}^{2} - {t}^{2}\right)}{t + \log z}}} \]
          4. *-commutativeN/A

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

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

            \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} - \color{blue}{t \cdot t}\right) \cdot y}{t + \log z}} \]
          7. fp-cancel-sub-sign-invN/A

            \[\leadsto x \cdot e^{\frac{\color{blue}{\left({\log z}^{2} + \left(\mathsf{neg}\left(t\right)\right) \cdot t\right)} \cdot y}{t + \log z}} \]
          8. distribute-lft-neg-inN/A

            \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} + \color{blue}{\left(\mathsf{neg}\left(t \cdot t\right)\right)}\right) \cdot y}{t + \log z}} \]
          9. unpow2N/A

            \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} + \left(\mathsf{neg}\left(\color{blue}{{t}^{2}}\right)\right)\right) \cdot y}{t + \log z}} \]
          10. mul-1-negN/A

            \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} + \color{blue}{-1 \cdot {t}^{2}}\right) \cdot y}{t + \log z}} \]
          11. +-commutativeN/A

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

            \[\leadsto x \cdot e^{\frac{\left(\color{blue}{\left(\mathsf{neg}\left({t}^{2}\right)\right)} + {\log z}^{2}\right) \cdot y}{t + \log z}} \]
          13. unpow2N/A

            \[\leadsto x \cdot e^{\frac{\left(\left(\mathsf{neg}\left(\color{blue}{t \cdot t}\right)\right) + {\log z}^{2}\right) \cdot y}{t + \log z}} \]
          14. distribute-lft-neg-inN/A

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

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

            \[\leadsto x \cdot e^{\frac{\mathsf{fma}\left(\color{blue}{-t}, t, {\log z}^{2}\right) \cdot y}{t + \log z}} \]
          17. lower-pow.f64N/A

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

            \[\leadsto x \cdot e^{\frac{\mathsf{fma}\left(-t, t, {\color{blue}{\log z}}^{2}\right) \cdot y}{t + \log z}} \]
        7. Applied rewrites93.9%

          \[\leadsto x \cdot e^{\color{blue}{\frac{\mathsf{fma}\left(-t, t, {\log z}^{2}\right) \cdot y}{t + \log z}}} \]
        8. Step-by-step derivation
          1. lift-*.f64N/A

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

            \[\leadsto \color{blue}{e^{\frac{\mathsf{fma}\left(-t, t, {\log z}^{2}\right) \cdot y}{t + \log z}} \cdot x} \]
          3. lower-*.f6493.9

            \[\leadsto \color{blue}{e^{\frac{\mathsf{fma}\left(-t, t, {\log z}^{2}\right) \cdot y}{t + \log z}} \cdot x} \]
        9. Applied rewrites93.9%

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

        if -1.06e11 < y < 3.6500000000000001e-16

        1. Initial program 97.7%

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

          \[\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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -106000000000 \lor \neg \left(y \leq 3.65 \cdot 10^{-16}\right):\\ \;\;\;\;e^{\left(\log z - t\right) \cdot y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)}\\ \end{array} \]
        10. Add Preprocessing

        Alternative 4: 84.2% accurate, 1.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -43 \lor \neg \left(t \leq -3.55 \cdot 10^{-202}\right):\\ \;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log z \cdot y} \cdot x\\ \end{array} \end{array} \]
        (FPCore (x y z t a b)
         :precision binary64
         (if (or (<= t -43.0) (not (<= t -3.55e-202)))
           (* x (exp (fma (- b) a (* (- t) y))))
           (* (exp (* (log z) y)) x)))
        double code(double x, double y, double z, double t, double a, double b) {
        	double tmp;
        	if ((t <= -43.0) || !(t <= -3.55e-202)) {
        		tmp = x * exp(fma(-b, a, (-t * y)));
        	} else {
        		tmp = exp((log(z) * y)) * x;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t, a, b)
        	tmp = 0.0
        	if ((t <= -43.0) || !(t <= -3.55e-202))
        		tmp = Float64(x * exp(fma(Float64(-b), a, Float64(Float64(-t) * y))));
        	else
        		tmp = Float64(exp(Float64(log(z) * y)) * x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -43.0], N[Not[LessEqual[t, -3.55e-202]], $MachinePrecision]], N[(x * N[Exp[N[((-b) * a + N[((-t) * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;t \leq -43 \lor \neg \left(t \leq -3.55 \cdot 10^{-202}\right):\\
        \;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;e^{\log z \cdot y} \cdot x\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if t < -43 or -3.55e-202 < t

          1. Initial program 98.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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)} \]

            if -43 < t < -3.55e-202

            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. Step-by-step derivation
              1. lift-*.f64N/A

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

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

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

                \[\leadsto x \cdot e^{\color{blue}{\frac{\log z \cdot \log z - t \cdot t}{\log z + t}} \cdot y + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
              5. associate-*l/N/A

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

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

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

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

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

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

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

                \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} - t \cdot t\right) \cdot y}{\color{blue}{t + \log z}} + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
              13. lower-+.f6495.9

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

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

              \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(\frac{{\log z}^{2}}{t + \log z} - \frac{{t}^{2}}{t + \log z}\right)}} \]
            6. Step-by-step derivation
              1. div-subN/A

                \[\leadsto x \cdot e^{y \cdot \color{blue}{\frac{{\log z}^{2} - {t}^{2}}{t + \log z}}} \]
              2. associate-/l*N/A

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

                \[\leadsto x \cdot e^{\color{blue}{\frac{y \cdot \left({\log z}^{2} - {t}^{2}\right)}{t + \log z}}} \]
              4. *-commutativeN/A

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

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

                \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} - \color{blue}{t \cdot t}\right) \cdot y}{t + \log z}} \]
              7. fp-cancel-sub-sign-invN/A

                \[\leadsto x \cdot e^{\frac{\color{blue}{\left({\log z}^{2} + \left(\mathsf{neg}\left(t\right)\right) \cdot t\right)} \cdot y}{t + \log z}} \]
              8. distribute-lft-neg-inN/A

                \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} + \color{blue}{\left(\mathsf{neg}\left(t \cdot t\right)\right)}\right) \cdot y}{t + \log z}} \]
              9. unpow2N/A

                \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} + \left(\mathsf{neg}\left(\color{blue}{{t}^{2}}\right)\right)\right) \cdot y}{t + \log z}} \]
              10. mul-1-negN/A

                \[\leadsto x \cdot e^{\frac{\left({\log z}^{2} + \color{blue}{-1 \cdot {t}^{2}}\right) \cdot y}{t + \log z}} \]
              11. +-commutativeN/A

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

                \[\leadsto x \cdot e^{\frac{\left(\color{blue}{\left(\mathsf{neg}\left({t}^{2}\right)\right)} + {\log z}^{2}\right) \cdot y}{t + \log z}} \]
              13. unpow2N/A

                \[\leadsto x \cdot e^{\frac{\left(\left(\mathsf{neg}\left(\color{blue}{t \cdot t}\right)\right) + {\log z}^{2}\right) \cdot y}{t + \log z}} \]
              14. distribute-lft-neg-inN/A

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

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

                \[\leadsto x \cdot e^{\frac{\mathsf{fma}\left(\color{blue}{-t}, t, {\log z}^{2}\right) \cdot y}{t + \log z}} \]
              17. lower-pow.f64N/A

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

                \[\leadsto x \cdot e^{\frac{\mathsf{fma}\left(-t, t, {\color{blue}{\log z}}^{2}\right) \cdot y}{t + \log z}} \]
            7. Applied rewrites71.0%

              \[\leadsto x \cdot e^{\color{blue}{\frac{\mathsf{fma}\left(-t, t, {\log z}^{2}\right) \cdot y}{t + \log z}}} \]
            8. Step-by-step derivation
              1. lift-*.f64N/A

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

                \[\leadsto \color{blue}{e^{\frac{\mathsf{fma}\left(-t, t, {\log z}^{2}\right) \cdot y}{t + \log z}} \cdot x} \]
              3. lower-*.f6471.0

                \[\leadsto \color{blue}{e^{\frac{\mathsf{fma}\left(-t, t, {\log z}^{2}\right) \cdot y}{t + \log z}} \cdot x} \]
            9. Applied rewrites71.0%

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

              \[\leadsto e^{y \cdot \color{blue}{\log z}} \cdot x \]
            11. Step-by-step derivation
              1. Applied rewrites71.0%

                \[\leadsto e^{\log z \cdot \color{blue}{y}} \cdot x \]
            12. Recombined 2 regimes into one program.
            13. Final simplification88.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -43 \lor \neg \left(t \leq -3.55 \cdot 10^{-202}\right):\\ \;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(-t\right) \cdot y\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log z \cdot y} \cdot x\\ \end{array} \]
            14. Add Preprocessing

            Alternative 5: 96.4% accurate, 1.5× speedup?

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

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

              \[\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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

            Alternative 6: 72.1% accurate, 2.6× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{+48} \lor \neg \left(y \leq 1.4 \cdot 10^{-12}\right):\\ \;\;\;\;x \cdot e^{\left(-y\right) \cdot t}\\ \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 -1.75e+48) (not (<= y 1.4e-12)))
               (* x (exp (* (- y) t)))
               (* x (exp (* (- (- z) b) a)))))
            double code(double x, double y, double z, double t, double a, double b) {
            	double tmp;
            	if ((y <= -1.75e+48) || !(y <= 1.4e-12)) {
            		tmp = x * exp((-y * t));
            	} else {
            		tmp = x * exp(((-z - b) * a));
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z, t, a, b)
            use fmin_fmax_functions
                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.75d+48)) .or. (.not. (y <= 1.4d-12))) then
                    tmp = x * exp((-y * t))
                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 <= -1.75e+48) || !(y <= 1.4e-12)) {
            		tmp = x * Math.exp((-y * t));
            	} else {
            		tmp = x * Math.exp(((-z - b) * a));
            	}
            	return tmp;
            }
            
            def code(x, y, z, t, a, b):
            	tmp = 0
            	if (y <= -1.75e+48) or not (y <= 1.4e-12):
            		tmp = x * math.exp((-y * t))
            	else:
            		tmp = x * math.exp(((-z - b) * a))
            	return tmp
            
            function code(x, y, z, t, a, b)
            	tmp = 0.0
            	if ((y <= -1.75e+48) || !(y <= 1.4e-12))
            		tmp = Float64(x * exp(Float64(Float64(-y) * t)));
            	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 <= -1.75e+48) || ~((y <= 1.4e-12)))
            		tmp = x * exp((-y * t));
            	else
            		tmp = x * exp(((-z - b) * a));
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.75e+48], N[Not[LessEqual[y, 1.4e-12]], $MachinePrecision]], N[(x * N[Exp[N[((-y) * t), $MachinePrecision]], $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 -1.75 \cdot 10^{+48} \lor \neg \left(y \leq 1.4 \cdot 10^{-12}\right):\\
            \;\;\;\;x \cdot e^{\left(-y\right) \cdot t}\\
            
            \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 < -1.7499999999999999e48 or 1.4000000000000001e-12 < y

              1. Initial program 98.3%

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

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

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

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

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

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

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

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

              if -1.7499999999999999e48 < y < 1.4000000000000001e-12

              1. Initial program 97.2%

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

                \[\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. *-lft-identityN/A

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

                  \[\leadsto x \cdot e^{\left(\log \left(1 - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) - b\right) \cdot a} \]
                6. cancel-sign-subN/A

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

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

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

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

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

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

              Alternative 7: 69.0% accurate, 2.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.2 \cdot 10^{-79} \lor \neg \left(b \leq 1.2 \cdot 10^{+145}\right):\\ \;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;x \cdot e^{\left(-y\right) \cdot t}\\ \end{array} \end{array} \]
              (FPCore (x y z t a b)
               :precision binary64
               (if (or (<= b -5.2e-79) (not (<= b 1.2e+145)))
                 (* x (exp (* (- b) a)))
                 (* x (exp (* (- y) t)))))
              double code(double x, double y, double z, double t, double a, double b) {
              	double tmp;
              	if ((b <= -5.2e-79) || !(b <= 1.2e+145)) {
              		tmp = x * exp((-b * a));
              	} else {
              		tmp = x * exp((-y * t));
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y, z, t, a, b)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8), intent (in) :: t
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  real(8) :: tmp
                  if ((b <= (-5.2d-79)) .or. (.not. (b <= 1.2d+145))) then
                      tmp = x * exp((-b * a))
                  else
                      tmp = x * exp((-y * t))
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z, double t, double a, double b) {
              	double tmp;
              	if ((b <= -5.2e-79) || !(b <= 1.2e+145)) {
              		tmp = x * Math.exp((-b * a));
              	} else {
              		tmp = x * Math.exp((-y * t));
              	}
              	return tmp;
              }
              
              def code(x, y, z, t, a, b):
              	tmp = 0
              	if (b <= -5.2e-79) or not (b <= 1.2e+145):
              		tmp = x * math.exp((-b * a))
              	else:
              		tmp = x * math.exp((-y * t))
              	return tmp
              
              function code(x, y, z, t, a, b)
              	tmp = 0.0
              	if ((b <= -5.2e-79) || !(b <= 1.2e+145))
              		tmp = Float64(x * exp(Float64(Float64(-b) * a)));
              	else
              		tmp = Float64(x * exp(Float64(Float64(-y) * t)));
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z, t, a, b)
              	tmp = 0.0;
              	if ((b <= -5.2e-79) || ~((b <= 1.2e+145)))
              		tmp = x * exp((-b * a));
              	else
              		tmp = x * exp((-y * t));
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -5.2e-79], N[Not[LessEqual[b, 1.2e+145]], $MachinePrecision]], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-y) * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;b \leq -5.2 \cdot 10^{-79} \lor \neg \left(b \leq 1.2 \cdot 10^{+145}\right):\\
              \;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
              
              \mathbf{else}:\\
              \;\;\;\;x \cdot e^{\left(-y\right) \cdot t}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if b < -5.19999999999999987e-79 or 1.19999999999999996e145 < b

                1. Initial program 99.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 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. *-lft-identityN/A

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

                    \[\leadsto x \cdot e^{\left(\log \left(1 - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) - b\right) \cdot a} \]
                  6. cancel-sign-subN/A

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

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

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

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

                  \[\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 b\right) \cdot a} \]
                7. Step-by-step derivation
                  1. Applied rewrites77.2%

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

                  if -5.19999999999999987e-79 < b < 1.19999999999999996e145

                  1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

                Alternative 8: 84.2% accurate, 2.7× speedup?

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

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

                  \[\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. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 9: 58.6% accurate, 2.9× speedup?

                  \[\begin{array}{l} \\ x \cdot e^{\left(-b\right) \cdot a} \end{array} \]
                  (FPCore (x y z t a b) :precision binary64 (* x (exp (* (- b) a))))
                  double code(double x, double y, double z, double t, double a, double b) {
                  	return x * exp((-b * a));
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, y, z, t, a, b)
                  use fmin_fmax_functions
                      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((-b * a))
                  end function
                  
                  public static double code(double x, double y, double z, double t, double a, double b) {
                  	return x * Math.exp((-b * a));
                  }
                  
                  def code(x, y, z, t, a, b):
                  	return x * math.exp((-b * a))
                  
                  function code(x, y, z, t, a, b)
                  	return Float64(x * exp(Float64(Float64(-b) * a)))
                  end
                  
                  function tmp = code(x, y, z, t, a, b)
                  	tmp = x * exp((-b * a));
                  end
                  
                  code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  x \cdot e^{\left(-b\right) \cdot a}
                  \end{array}
                  
                  Derivation
                  1. Initial program 97.7%

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

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

                      \[\leadsto x \cdot e^{\left(\log \left(1 - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) - b\right) \cdot a} \]
                    6. cancel-sign-subN/A

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

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

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

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

                    \[\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 b\right) \cdot a} \]
                  7. Step-by-step derivation
                    1. Applied rewrites54.7%

                      \[\leadsto x \cdot e^{\left(-b\right) \cdot a} \]
                    2. Add Preprocessing

                    Reproduce

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