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

Percentage Accurate: 96.4% → 99.3%
Time: 5.8s
Alternatives: 12
Speedup: 1.2×

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}

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 12 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.4% 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: 99.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot e^{\mathsf{fma}\left(-a, b, \left(\log z - t\right) \cdot y\right)}\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{-14}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-24}:\\ \;\;\;\;e^{\mathsf{fma}\left(\left(-z\right) - b, a, \left(-t\right) \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 (* x (exp (fma (- a) b (* (- (log z) t) y))))))
   (if (<= y -1.3e-14)
     t_1
     (if (<= y 2e-24) (* (exp (fma (- (- z) b) a (* (- t) y))) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x * exp(fma(-a, b, ((log(z) - t) * y)));
	double tmp;
	if (y <= -1.3e-14) {
		tmp = t_1;
	} else if (y <= 2e-24) {
		tmp = exp(fma((-z - b), a, (-t * y))) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(x * exp(fma(Float64(-a), b, Float64(Float64(log(z) - t) * y))))
	tmp = 0.0
	if (y <= -1.3e-14)
		tmp = t_1;
	elseif (y <= 2e-24)
		tmp = Float64(exp(fma(Float64(Float64(-z) - b), a, Float64(Float64(-t) * y))) * x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[((-a) * b + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3e-14], t$95$1, If[LessEqual[y, 2e-24], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a + N[((-t) * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot e^{\mathsf{fma}\left(-a, b, \left(\log z - t\right) \cdot y\right)}\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 2 \cdot 10^{-24}:\\
\;\;\;\;e^{\mathsf{fma}\left(\left(-z\right) - b, a, \left(-t\right) \cdot y\right)} \cdot x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.29999999999999998e-14 or 1.99999999999999985e-24 < y

    1. Initial program 97.9%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. 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)}} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto x \cdot e^{\mathsf{fma}\left(\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(-a, b, y \cdot \left(\log z - t\right)\right)} \]
      5. *-commutativeN/A

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

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

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

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

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

    if -1.29999999999999998e-14 < y < 1.99999999999999985e-24

    1. Initial program 94.7%

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

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

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\mathsf{neg}\left(z\right)\right) - b\right)} \]
      2. lower-neg.f6499.9

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(-z\right) - b\right)} \]
    4. Applied rewrites99.9%

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

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

        \[\leadsto x \cdot e^{y \cdot \left(\mathsf{neg}\left(t\right)\right) + a \cdot \left(\left(-z\right) - b\right)} \]
      2. lift-neg.f6499.9

        \[\leadsto x \cdot e^{y \cdot \left(-t\right) + a \cdot \left(\left(-z\right) - b\right)} \]
    7. Applied rewrites99.9%

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

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

        \[\leadsto \color{blue}{e^{y \cdot \left(-t\right) + a \cdot \left(\left(-z\right) - b\right)} \cdot x} \]
      3. lower-*.f6499.9

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\left(-z\right) - b, a, \left(-t\right) \cdot y\right)} \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.0% accurate, 1.2× speedup?

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

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

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

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

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\mathsf{neg}\left(z\right)\right) - b\right)} \]
    2. lower-neg.f6499.3

      \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(-z\right) - b\right)} \]
  4. Applied rewrites99.3%

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

Alternative 3: 93.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\ \mathbf{if}\;y \leq -2.25 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+117}:\\ \;\;\;\;e^{\mathsf{fma}\left(\left(-z\right) - b, a, \left(-t\right) \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 (* (- (log z) t) y)) x)))
   (if (<= y -2.25e-13)
     t_1
     (if (<= y 2.3e+117) (* (exp (fma (- (- z) b) a (* (- t) y))) 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 <= -2.25e-13) {
		tmp = t_1;
	} else if (y <= 2.3e+117) {
		tmp = exp(fma((-z - b), a, (-t * y))) * 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 <= -2.25e-13)
		tmp = t_1;
	elseif (y <= 2.3e+117)
		tmp = Float64(exp(fma(Float64(Float64(-z) - b), a, Float64(Float64(-t) * 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[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -2.25e-13], t$95$1, If[LessEqual[y, 2.3e+117], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a + N[((-t) * y), $MachinePrecision]), $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 -2.25 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 2.3 \cdot 10^{+117}:\\
\;\;\;\;e^{\mathsf{fma}\left(\left(-z\right) - b, a, \left(-t\right) \cdot y\right)} \cdot x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.25e-13 or 2.29999999999999988e117 < y

    1. Initial program 97.9%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6489.0

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites89.0%

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

    if -2.25e-13 < y < 2.29999999999999988e117

    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. Taylor expanded in z around 0

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

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(\mathsf{neg}\left(z\right)\right) - b\right)} \]
      2. lower-neg.f6499.9

        \[\leadsto x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\left(-z\right) - b\right)} \]
    4. Applied rewrites99.9%

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

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

        \[\leadsto x \cdot e^{y \cdot \left(\mathsf{neg}\left(t\right)\right) + a \cdot \left(\left(-z\right) - b\right)} \]
      2. lift-neg.f6495.8

        \[\leadsto x \cdot e^{y \cdot \left(-t\right) + a \cdot \left(\left(-z\right) - b\right)} \]
    7. Applied rewrites95.8%

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

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

        \[\leadsto \color{blue}{e^{y \cdot \left(-t\right) + a \cdot \left(\left(-z\right) - b\right)} \cdot x} \]
      3. lower-*.f6495.8

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\left(-z\right) - b, a, \left(-t\right) \cdot y\right)} \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 89.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\ \mathbf{if}\;y \leq -2.25 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+117}:\\ \;\;\;\;x \cdot e^{\mathsf{fma}\left(-a, b, \left(-t\right) \cdot y\right)}\\ \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 -2.25e-13)
     t_1
     (if (<= y 2.3e+117) (* x (exp (fma (- a) b (* (- t) y)))) 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 <= -2.25e-13) {
		tmp = t_1;
	} else if (y <= 2.3e+117) {
		tmp = x * exp(fma(-a, b, (-t * y)));
	} 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 <= -2.25e-13)
		tmp = t_1;
	elseif (y <= 2.3e+117)
		tmp = Float64(x * exp(fma(Float64(-a), b, Float64(Float64(-t) * y))));
	else
		tmp = t_1;
	end
	return 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, -2.25e-13], t$95$1, If[LessEqual[y, 2.3e+117], N[(x * N[Exp[N[((-a) * b + N[((-t) * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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 -2.25 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 2.3 \cdot 10^{+117}:\\
\;\;\;\;x \cdot e^{\mathsf{fma}\left(-a, b, \left(-t\right) \cdot y\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.25e-13 or 2.29999999999999988e117 < y

    1. Initial program 97.9%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6489.0

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites89.0%

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

    if -2.25e-13 < y < 2.29999999999999988e117

    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. 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)}} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto x \cdot e^{\mathsf{fma}\left(\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(-a, b, y \cdot \left(\log z - t\right)\right)} \]
      5. *-commutativeN/A

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

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

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

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

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

      \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \left(-1 \cdot t\right) \cdot y\right)} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

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

        \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \left(-t\right) \cdot y\right)} \]
    7. Applied rewrites90.5%

      \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \left(-t\right) \cdot y\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 84.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot e^{\mathsf{fma}\left(-a, b, \left(-t\right) \cdot y\right)}\\ \mathbf{if}\;t \leq -1.45 \cdot 10^{-133}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 6.2 \cdot 10^{-253}:\\ \;\;\;\;{z}^{y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* x (exp (fma (- a) b (* (- t) y))))))
   (if (<= t -1.45e-133) t_1 (if (<= t 6.2e-253) (* (pow z y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = x * exp(fma(-a, b, (-t * y)));
	double tmp;
	if (t <= -1.45e-133) {
		tmp = t_1;
	} else if (t <= 6.2e-253) {
		tmp = pow(z, y) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(x * exp(fma(Float64(-a), b, Float64(Float64(-t) * y))))
	tmp = 0.0
	if (t <= -1.45e-133)
		tmp = t_1;
	elseif (t <= 6.2e-253)
		tmp = Float64((z ^ y) * x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[((-a) * b + N[((-t) * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.45e-133], t$95$1, If[LessEqual[t, 6.2e-253], N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot e^{\mathsf{fma}\left(-a, b, \left(-t\right) \cdot y\right)}\\
\mathbf{if}\;t \leq -1.45 \cdot 10^{-133}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 6.2 \cdot 10^{-253}:\\
\;\;\;\;{z}^{y} \cdot x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.4499999999999999e-133 or 6.19999999999999991e-253 < t

    1. Initial program 96.3%

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. 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)}} \]
    3. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto x \cdot e^{\mathsf{fma}\left(\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(-a, b, y \cdot \left(\log z - t\right)\right)} \]
      5. *-commutativeN/A

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

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

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

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

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

      \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \left(-1 \cdot t\right) \cdot y\right)} \]
    6. Step-by-step derivation
      1. mul-1-negN/A

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

        \[\leadsto x \cdot e^{\mathsf{fma}\left(-a, b, \left(-t\right) \cdot y\right)} \]
    7. Applied rewrites88.0%

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

    if -1.4499999999999999e-133 < t < 6.19999999999999991e-253

    1. Initial program 96.8%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6466.4

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites66.4%

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

      \[\leadsto {z}^{y} \cdot x \]
    6. Step-by-step derivation
      1. lower-pow.f6466.4

        \[\leadsto {z}^{y} \cdot x \]
    7. Applied rewrites66.4%

      \[\leadsto {z}^{y} \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 73.5% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := {z}^{y} \cdot x\\ \mathbf{if}\;y \leq -2.25 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 4800:\\ \;\;\;\;e^{\left(-a\right) \cdot b} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (pow z y) x)))
   (if (<= y -2.25e-13) t_1 (if (<= y 4800.0) (* (exp (* (- a) b)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = pow(z, y) * x;
	double tmp;
	if (y <= -2.25e-13) {
		tmp = t_1;
	} else if (y <= 4800.0) {
		tmp = exp((-a * b)) * x;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = (z ** y) * x
    if (y <= (-2.25d-13)) then
        tmp = t_1
    else if (y <= 4800.0d0) then
        tmp = exp((-a * b)) * 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.pow(z, y) * x;
	double tmp;
	if (y <= -2.25e-13) {
		tmp = t_1;
	} else if (y <= 4800.0) {
		tmp = Math.exp((-a * b)) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = math.pow(z, y) * x
	tmp = 0
	if y <= -2.25e-13:
		tmp = t_1
	elif y <= 4800.0:
		tmp = math.exp((-a * b)) * x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64((z ^ y) * x)
	tmp = 0.0
	if (y <= -2.25e-13)
		tmp = t_1;
	elseif (y <= 4800.0)
		tmp = Float64(exp(Float64(Float64(-a) * b)) * x);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (z ^ y) * x;
	tmp = 0.0;
	if (y <= -2.25e-13)
		tmp = t_1;
	elseif (y <= 4800.0)
		tmp = exp((-a * b)) * x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -2.25e-13], t$95$1, If[LessEqual[y, 4800.0], N[(N[Exp[N[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := {z}^{y} \cdot x\\
\mathbf{if}\;y \leq -2.25 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 4800:\\
\;\;\;\;e^{\left(-a\right) \cdot b} \cdot x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.25e-13 or 4800 < y

    1. Initial program 98.0%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6487.9

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites87.9%

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

      \[\leadsto {z}^{y} \cdot x \]
    6. Step-by-step derivation
      1. lower-pow.f6467.3

        \[\leadsto {z}^{y} \cdot x \]
    7. Applied rewrites67.3%

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

    if -2.25e-13 < y < 4800

    1. Initial program 94.8%

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

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

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

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

        \[\leadsto x \cdot e^{\left(\mathsf{neg}\left(a\right)\right) \cdot b} \]
      4. lower-neg.f6479.8

        \[\leadsto x \cdot e^{\left(-a\right) \cdot b} \]
    4. Applied rewrites79.8%

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

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

        \[\leadsto \color{blue}{e^{\left(-a\right) \cdot b} \cdot x} \]
      3. lower-*.f6479.8

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

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

Alternative 7: 70.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := e^{\left(-a\right) \cdot b} \cdot x\\ \mathbf{if}\;a \leq -1.85 \cdot 10^{+20}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.6 \cdot 10^{-30}:\\ \;\;\;\;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 (* (- a) b)) x)))
   (if (<= a -1.85e+20) t_1 (if (<= a 1.6e-30) (* (exp (* (- t) y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = exp((-a * b)) * x;
	double tmp;
	if (a <= -1.85e+20) {
		tmp = t_1;
	} else if (a <= 1.6e-30) {
		tmp = exp((-t * y)) * x;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = exp((-a * b)) * x
    if (a <= (-1.85d+20)) then
        tmp = t_1
    else if (a <= 1.6d-30) 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((-a * b)) * x;
	double tmp;
	if (a <= -1.85e+20) {
		tmp = t_1;
	} else if (a <= 1.6e-30) {
		tmp = Math.exp((-t * y)) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = math.exp((-a * b)) * x
	tmp = 0
	if a <= -1.85e+20:
		tmp = t_1
	elif a <= 1.6e-30:
		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(-a) * b)) * x)
	tmp = 0.0
	if (a <= -1.85e+20)
		tmp = t_1;
	elseif (a <= 1.6e-30)
		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((-a * b)) * x;
	tmp = 0.0;
	if (a <= -1.85e+20)
		tmp = t_1;
	elseif (a <= 1.6e-30)
		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[((-a) * b), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[a, -1.85e+20], t$95$1, If[LessEqual[a, 1.6e-30], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := e^{\left(-a\right) \cdot b} \cdot x\\
\mathbf{if}\;a \leq -1.85 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 1.6 \cdot 10^{-30}:\\
\;\;\;\;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 < -1.85e20 or 1.6e-30 < a

    1. Initial program 93.0%

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

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

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

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

        \[\leadsto x \cdot e^{\left(\mathsf{neg}\left(a\right)\right) \cdot b} \]
      4. lower-neg.f6469.4

        \[\leadsto x \cdot e^{\left(-a\right) \cdot b} \]
    4. Applied rewrites69.4%

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

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

        \[\leadsto \color{blue}{e^{\left(-a\right) \cdot b} \cdot x} \]
      3. lower-*.f6469.4

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

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

    if -1.85e20 < a < 1.6e-30

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto x \cdot e^{\left(-t\right) \cdot y} \]
    4. Applied rewrites71.2%

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

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

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

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

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

Alternative 8: 60.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.26 \cdot 10^{+186}:\\
\;\;\;\;\mathsf{fma}\left(\log z - t, y, 1\right) \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.26e186

    1. Initial program 97.1%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6492.3

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites92.3%

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

      \[\leadsto \left(1 + y \cdot \left(\log z - t\right)\right) \cdot x \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(y \cdot \left(\log z - t\right) + 1\right) \cdot x \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\log z - t\right) \cdot y + 1\right) \cdot x \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      5. lift--.f6443.8

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
    7. Applied rewrites43.8%

      \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]

    if -1.26e186 < y

    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. Taylor expanded in b around inf

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

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

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

        \[\leadsto x \cdot e^{\left(\mathsf{neg}\left(a\right)\right) \cdot b} \]
      4. lower-neg.f6461.8

        \[\leadsto x \cdot e^{\left(-a\right) \cdot b} \]
    4. Applied rewrites61.8%

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

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

        \[\leadsto \color{blue}{e^{\left(-a\right) \cdot b} \cdot x} \]
      3. lower-*.f6461.8

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

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

Alternative 9: 34.9% accurate, 0.9× speedup?

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

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

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


\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))) < -2.00000000000000006e83

    1. Initial program 99.4%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6468.9

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites68.9%

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

      \[\leadsto \left(1 + y \cdot \left(\log z - t\right)\right) \cdot x \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(y \cdot \left(\log z - t\right) + 1\right) \cdot x \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\log z - t\right) \cdot y + 1\right) \cdot x \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      5. lift--.f642.6

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
    7. Applied rewrites2.6%

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

      \[\leadsto \left(-1 \cdot \left(t \cdot y\right)\right) \cdot x \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(t \cdot y\right)\right) \cdot x \]
      2. distribute-lft-neg-outN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot y\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(-t\right) \cdot y\right) \cdot x \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-t\right)\right) \cdot x \]
      5. lower-*.f6414.2

        \[\leadsto \left(y \cdot \left(-t\right)\right) \cdot x \]
    10. Applied rewrites14.2%

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

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

    1. Initial program 94.9%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6473.8

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites73.8%

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

      \[\leadsto \left(1 + y \cdot \left(\log z - t\right)\right) \cdot x \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(y \cdot \left(\log z - t\right) + 1\right) \cdot x \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\log z - t\right) \cdot y + 1\right) \cdot x \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      5. lift--.f6445.3

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
    7. Applied rewrites45.3%

      \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 32.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y \cdot \left(-t\right)\right) \cdot x\\ t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+83}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 10^{+306}:\\ \;\;\;\;\mathsf{fma}\left(\log z, y, 1\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (* y (- t)) x))
        (t_2 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
   (if (<= t_2 -2e+83)
     t_1
     (if (<= t_2 1e+306) (* (fma (log z) y 1.0) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (y * -t) * x;
	double t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
	double tmp;
	if (t_2 <= -2e+83) {
		tmp = t_1;
	} else if (t_2 <= 1e+306) {
		tmp = fma(log(z), y, 1.0) * x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(y * Float64(-t)) * x)
	t_2 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b)))
	tmp = 0.0
	if (t_2 <= -2e+83)
		tmp = t_1;
	elseif (t_2 <= 1e+306)
		tmp = Float64(fma(log(z), y, 1.0) * x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * (-t)), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -2e+83], t$95$1, If[LessEqual[t$95$2, 1e+306], N[(N[(N[Log[z], $MachinePrecision] * y + 1.0), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y \cdot \left(-t\right)\right) \cdot x\\
t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(\log z, y, 1\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\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))) < -2.00000000000000006e83 or 1.00000000000000002e306 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b)))

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6468.2

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites68.2%

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

      \[\leadsto \left(1 + y \cdot \left(\log z - t\right)\right) \cdot x \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(y \cdot \left(\log z - t\right) + 1\right) \cdot x \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\log z - t\right) \cdot y + 1\right) \cdot x \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      5. lift--.f6417.0

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
    7. Applied rewrites17.0%

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

      \[\leadsto \left(-1 \cdot \left(t \cdot y\right)\right) \cdot x \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(t \cdot y\right)\right) \cdot x \]
      2. distribute-lft-neg-outN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot y\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(-t\right) \cdot y\right) \cdot x \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-t\right)\right) \cdot x \]
      5. lower-*.f6424.8

        \[\leadsto \left(y \cdot \left(-t\right)\right) \cdot x \]
    10. Applied rewrites24.8%

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

    if -2.00000000000000006e83 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 1.00000000000000002e306

    1. Initial program 95.0%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6475.5

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites75.5%

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

      \[\leadsto {z}^{y} \cdot x \]
    6. Step-by-step derivation
      1. lower-pow.f6459.4

        \[\leadsto {z}^{y} \cdot x \]
    7. Applied rewrites59.4%

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

      \[\leadsto \left(1 + y \cdot \log z\right) \cdot x \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(y \cdot \log z + 1\right) \cdot x \]
      2. *-commutativeN/A

        \[\leadsto \left(\log z \cdot y + 1\right) \cdot x \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z, y, 1\right) \cdot x \]
      4. lift-log.f6438.9

        \[\leadsto \mathsf{fma}\left(\log z, y, 1\right) \cdot x \]
    10. Applied rewrites38.9%

      \[\leadsto \mathsf{fma}\left(\log z, y, 1\right) \cdot x \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 31.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y \cdot \left(-t\right)\right) \cdot x\\ t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+83}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+126}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (* y (- t)) x))
        (t_2 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
   (if (<= t_2 -2e+83) t_1 (if (<= t_2 5e+126) x t_1))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (y * -t) * x;
	double t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
	double tmp;
	if (t_2 <= -2e+83) {
		tmp = t_1;
	} else if (t_2 <= 5e+126) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (y * -t) * x
    t_2 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
    if (t_2 <= (-2d+83)) then
        tmp = t_1
    else if (t_2 <= 5d+126) then
        tmp = 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 = (y * -t) * x;
	double t_2 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
	double tmp;
	if (t_2 <= -2e+83) {
		tmp = t_1;
	} else if (t_2 <= 5e+126) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (y * -t) * x
	t_2 = (y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))
	tmp = 0
	if t_2 <= -2e+83:
		tmp = t_1
	elif t_2 <= 5e+126:
		tmp = x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(y * Float64(-t)) * x)
	t_2 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b)))
	tmp = 0.0
	if (t_2 <= -2e+83)
		tmp = t_1;
	elseif (t_2 <= 5e+126)
		tmp = x;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (y * -t) * x;
	t_2 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
	tmp = 0.0;
	if (t_2 <= -2e+83)
		tmp = t_1;
	elseif (t_2 <= 5e+126)
		tmp = x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * (-t)), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -2e+83], t$95$1, If[LessEqual[t$95$2, 5e+126], x, t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(y \cdot \left(-t\right)\right) \cdot x\\
t_2 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+126}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\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))) < -2.00000000000000006e83 or 4.99999999999999977e126 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b)))

    1. Initial program 98.4%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6469.3

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites69.3%

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

      \[\leadsto \left(1 + y \cdot \left(\log z - t\right)\right) \cdot x \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \left(y \cdot \left(\log z - t\right) + 1\right) \cdot x \]
      2. *-commutativeN/A

        \[\leadsto \left(\left(\log z - t\right) \cdot y + 1\right) \cdot x \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      4. lift-log.f64N/A

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
      5. lift--.f6420.0

        \[\leadsto \mathsf{fma}\left(\log z - t, y, 1\right) \cdot x \]
    7. Applied rewrites20.0%

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

      \[\leadsto \left(-1 \cdot \left(t \cdot y\right)\right) \cdot x \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(t \cdot y\right)\right) \cdot x \]
      2. distribute-lft-neg-outN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(t\right)\right) \cdot y\right) \cdot x \]
      3. lift-neg.f64N/A

        \[\leadsto \left(\left(-t\right) \cdot y\right) \cdot x \]
      4. *-commutativeN/A

        \[\leadsto \left(y \cdot \left(-t\right)\right) \cdot x \]
      5. lower-*.f6422.4

        \[\leadsto \left(y \cdot \left(-t\right)\right) \cdot x \]
    10. Applied rewrites22.4%

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

    if -2.00000000000000006e83 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 4.99999999999999977e126

    1. Initial program 92.8%

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6477.1

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites77.1%

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

      \[\leadsto x \]
    6. Step-by-step derivation
      1. Applied rewrites48.0%

        \[\leadsto x \]
    7. Recombined 2 regimes into one program.
    8. Add Preprocessing

    Alternative 12: 19.8% accurate, 42.1× speedup?

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

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

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

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

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

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

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

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      6. lift-log.f64N/A

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
      7. lift--.f6472.2

        \[\leadsto e^{\left(\log z - t\right) \cdot y} \cdot x \]
    4. Applied rewrites72.2%

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

      \[\leadsto x \]
    6. Step-by-step derivation
      1. Applied rewrites19.8%

        \[\leadsto x \]
      2. Add Preprocessing

      Reproduce

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