Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A

Percentage Accurate: 98.3% → 98.3%
Time: 6.2s
Alternatives: 15
Speedup: 1.0×

Specification

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

\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\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 15 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: 98.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 1.0× speedup?

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

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

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

Alternative 2: 93.7% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;t \leq 85:\\
\;\;\;\;\frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3400 or 85 < t

    1. Initial program 98.3%

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

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

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

        \[\leadsto \frac{x \cdot e^{\log a \cdot \left(\color{blue}{t} - 1\right) - b}}{y} \]
      3. lift--.f6480.1

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

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

    if -3400 < t < 85

    1. Initial program 98.3%

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

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

        \[\leadsto \frac{x \cdot e^{-1 \cdot \log a + \left(y \cdot \log z - b\right)}}{y} \]
      2. exp-sumN/A

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

        \[\leadsto \frac{x \cdot \left(e^{\log a \cdot -1} \cdot e^{\color{blue}{y \cdot \log z} - b}\right)}{y} \]
      4. pow-to-expN/A

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{y \cdot \log z - b}\right)}{y} \]
      10. *-commutativeN/A

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
      12. lift-log.f6480.8

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
    4. Applied rewrites80.8%

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

Alternative 3: 93.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;t \leq 6.8 \cdot 10^{-20}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3400 or 6.7999999999999994e-20 < t

    1. Initial program 98.3%

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

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

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

        \[\leadsto \frac{x \cdot e^{\log a \cdot \left(\color{blue}{t} - 1\right) - b}}{y} \]
      3. lift--.f6480.1

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

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

    if -3400 < t < 6.7999999999999994e-20

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 88.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x \cdot \frac{{z}^{y}}{a}}{y}\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+162}:\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot \left(t - 1\right) - b}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.1000000000000001e40 or 2.79999999999999991e162 < y

    1. Initial program 98.3%

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

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

        \[\leadsto \frac{x \cdot e^{-1 \cdot \log a + \left(y \cdot \log z - b\right)}}{y} \]
      2. exp-sumN/A

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

        \[\leadsto \frac{x \cdot \left(e^{\log a \cdot -1} \cdot e^{\color{blue}{y \cdot \log z} - b}\right)}{y} \]
      4. pow-to-expN/A

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{y \cdot \log z - b}\right)}{y} \]
      10. *-commutativeN/A

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
      12. lift-log.f6480.8

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
    4. Applied rewrites80.8%

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

      \[\leadsto \frac{x \cdot \frac{{z}^{y}}{\color{blue}{a}}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot \frac{{z}^{y}}{a}}{y} \]
      2. lower-pow.f6460.3

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

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

    if -2.1000000000000001e40 < y < 2.79999999999999991e162

    1. Initial program 98.3%

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

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

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

        \[\leadsto \frac{x \cdot e^{\log a \cdot \left(\color{blue}{t} - 1\right) - b}}{y} \]
      3. lift--.f6480.1

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

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

Alternative 5: 76.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := \frac{x \cdot e^{\log a \cdot t}}{y}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+49}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 360:\\
\;\;\;\;\frac{x \cdot \frac{{z}^{y}}{a}}{y}\\

\mathbf{elif}\;t\_1 \leq 10000000000:\\
\;\;\;\;\frac{x \cdot \frac{e^{-b}}{a}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -5.0000000000000004e49 or 1e10 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))

    1. Initial program 98.3%

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

      \[\leadsto \frac{x \cdot e^{\color{blue}{t \cdot \log a}}}{y} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{x \cdot e^{\log a \cdot \color{blue}{t}}}{y} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{x \cdot e^{\log a \cdot \color{blue}{t}}}{y} \]
      3. lift-log.f6448.2

        \[\leadsto \frac{x \cdot e^{\log a \cdot t}}{y} \]
    4. Applied rewrites48.2%

      \[\leadsto \frac{x \cdot e^{\color{blue}{\log a \cdot t}}}{y} \]

    if -5.0000000000000004e49 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 360

    1. Initial program 98.3%

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

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

        \[\leadsto \frac{x \cdot e^{-1 \cdot \log a + \left(y \cdot \log z - b\right)}}{y} \]
      2. exp-sumN/A

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

        \[\leadsto \frac{x \cdot \left(e^{\log a \cdot -1} \cdot e^{\color{blue}{y \cdot \log z} - b}\right)}{y} \]
      4. pow-to-expN/A

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{y \cdot \log z - b}\right)}{y} \]
      10. *-commutativeN/A

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
      12. lift-log.f6480.8

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
    4. Applied rewrites80.8%

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

      \[\leadsto \frac{x \cdot \frac{{z}^{y}}{\color{blue}{a}}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot \frac{{z}^{y}}{a}}{y} \]
      2. lower-pow.f6460.3

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

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

    if 360 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 1e10

    1. Initial program 98.3%

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

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

        \[\leadsto \frac{x \cdot e^{-1 \cdot \log a + \left(y \cdot \log z - b\right)}}{y} \]
      2. exp-sumN/A

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

        \[\leadsto \frac{x \cdot \left(e^{\log a \cdot -1} \cdot e^{\color{blue}{y \cdot \log z} - b}\right)}{y} \]
      4. pow-to-expN/A

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{y \cdot \log z - b}\right)}{y} \]
      10. *-commutativeN/A

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
      12. lift-log.f6480.8

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
    4. Applied rewrites80.8%

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

      \[\leadsto \frac{x \cdot \frac{e^{\mathsf{neg}\left(b\right)}}{\color{blue}{a}}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot \frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto \frac{x \cdot \frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.5

        \[\leadsto \frac{x \cdot \frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.5%

      \[\leadsto \frac{x \cdot \frac{e^{-b}}{\color{blue}{a}}}{y} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 75.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - 1\right) \cdot \log a\\ t_2 := \frac{e^{-b}}{a}\\ t_3 := \frac{x \cdot e^{\log a \cdot t}}{y}\\ \mathbf{if}\;t\_1 \leq -695:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_1 \leq -345:\\ \;\;\;\;x \cdot \frac{t\_2}{y}\\ \mathbf{elif}\;t\_1 \leq 360:\\ \;\;\;\;\frac{{z}^{y} \cdot x}{a \cdot y}\\ \mathbf{elif}\;t\_1 \leq 10000000000:\\ \;\;\;\;\frac{x \cdot t\_2}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (* (- t 1.0) (log a)))
        (t_2 (/ (exp (- b)) a))
        (t_3 (/ (* x (exp (* (log a) t))) y)))
   (if (<= t_1 -695.0)
     t_3
     (if (<= t_1 -345.0)
       (* x (/ t_2 y))
       (if (<= t_1 360.0)
         (/ (* (pow z y) x) (* a y))
         (if (<= t_1 10000000000.0) (/ (* x t_2) y) t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (t - 1.0) * log(a);
	double t_2 = exp(-b) / a;
	double t_3 = (x * exp((log(a) * t))) / y;
	double tmp;
	if (t_1 <= -695.0) {
		tmp = t_3;
	} else if (t_1 <= -345.0) {
		tmp = x * (t_2 / y);
	} else if (t_1 <= 360.0) {
		tmp = (pow(z, y) * x) / (a * y);
	} else if (t_1 <= 10000000000.0) {
		tmp = (x * t_2) / y;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = (t - 1.0d0) * log(a)
    t_2 = exp(-b) / a
    t_3 = (x * exp((log(a) * t))) / y
    if (t_1 <= (-695.0d0)) then
        tmp = t_3
    else if (t_1 <= (-345.0d0)) then
        tmp = x * (t_2 / y)
    else if (t_1 <= 360.0d0) then
        tmp = ((z ** y) * x) / (a * y)
    else if (t_1 <= 10000000000.0d0) then
        tmp = (x * t_2) / y
    else
        tmp = t_3
    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 = (t - 1.0) * Math.log(a);
	double t_2 = Math.exp(-b) / a;
	double t_3 = (x * Math.exp((Math.log(a) * t))) / y;
	double tmp;
	if (t_1 <= -695.0) {
		tmp = t_3;
	} else if (t_1 <= -345.0) {
		tmp = x * (t_2 / y);
	} else if (t_1 <= 360.0) {
		tmp = (Math.pow(z, y) * x) / (a * y);
	} else if (t_1 <= 10000000000.0) {
		tmp = (x * t_2) / y;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	t_1 = (t - 1.0) * math.log(a)
	t_2 = math.exp(-b) / a
	t_3 = (x * math.exp((math.log(a) * t))) / y
	tmp = 0
	if t_1 <= -695.0:
		tmp = t_3
	elif t_1 <= -345.0:
		tmp = x * (t_2 / y)
	elif t_1 <= 360.0:
		tmp = (math.pow(z, y) * x) / (a * y)
	elif t_1 <= 10000000000.0:
		tmp = (x * t_2) / y
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(t - 1.0) * log(a))
	t_2 = Float64(exp(Float64(-b)) / a)
	t_3 = Float64(Float64(x * exp(Float64(log(a) * t))) / y)
	tmp = 0.0
	if (t_1 <= -695.0)
		tmp = t_3;
	elseif (t_1 <= -345.0)
		tmp = Float64(x * Float64(t_2 / y));
	elseif (t_1 <= 360.0)
		tmp = Float64(Float64((z ^ y) * x) / Float64(a * y));
	elseif (t_1 <= 10000000000.0)
		tmp = Float64(Float64(x * t_2) / y);
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a, b)
	t_1 = (t - 1.0) * log(a);
	t_2 = exp(-b) / a;
	t_3 = (x * exp((log(a) * t))) / y;
	tmp = 0.0;
	if (t_1 <= -695.0)
		tmp = t_3;
	elseif (t_1 <= -345.0)
		tmp = x * (t_2 / y);
	elseif (t_1 <= 360.0)
		tmp = ((z ^ y) * x) / (a * y);
	elseif (t_1 <= 10000000000.0)
		tmp = (x * t_2) / y;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[(-b)], $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * N[Exp[N[(N[Log[a], $MachinePrecision] * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, -695.0], t$95$3, If[LessEqual[t$95$1, -345.0], N[(x * N[(t$95$2 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 360.0], N[(N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision] / N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 10000000000.0], N[(N[(x * t$95$2), $MachinePrecision] / y), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := \frac{e^{-b}}{a}\\
t_3 := \frac{x \cdot e^{\log a \cdot t}}{y}\\
\mathbf{if}\;t\_1 \leq -695:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_1 \leq -345:\\
\;\;\;\;x \cdot \frac{t\_2}{y}\\

\mathbf{elif}\;t\_1 \leq 360:\\
\;\;\;\;\frac{{z}^{y} \cdot x}{a \cdot y}\\

\mathbf{elif}\;t\_1 \leq 10000000000:\\
\;\;\;\;\frac{x \cdot t\_2}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -695 or 1e10 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))

    1. Initial program 98.3%

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

      \[\leadsto \frac{x \cdot e^{\color{blue}{t \cdot \log a}}}{y} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{x \cdot e^{\log a \cdot \color{blue}{t}}}{y} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{x \cdot e^{\log a \cdot \color{blue}{t}}}{y} \]
      3. lift-log.f6448.2

        \[\leadsto \frac{x \cdot e^{\log a \cdot t}}{y} \]
    4. Applied rewrites48.2%

      \[\leadsto \frac{x \cdot e^{\color{blue}{\log a \cdot t}}}{y} \]

    if -695 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -345

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.1

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.1%

      \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]

    if -345 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 360

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in b around 0

      \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      5. lower-*.f6454.8

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    7. Applied rewrites54.8%

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

    if 360 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 1e10

    1. Initial program 98.3%

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

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

        \[\leadsto \frac{x \cdot e^{-1 \cdot \log a + \left(y \cdot \log z - b\right)}}{y} \]
      2. exp-sumN/A

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

        \[\leadsto \frac{x \cdot \left(e^{\log a \cdot -1} \cdot e^{\color{blue}{y \cdot \log z} - b}\right)}{y} \]
      4. pow-to-expN/A

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{y \cdot \log z - b}\right)}{y} \]
      10. *-commutativeN/A

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
      12. lift-log.f6480.8

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
    4. Applied rewrites80.8%

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

      \[\leadsto \frac{x \cdot \frac{e^{\mathsf{neg}\left(b\right)}}{\color{blue}{a}}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot \frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto \frac{x \cdot \frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.5

        \[\leadsto \frac{x \cdot \frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.5%

      \[\leadsto \frac{x \cdot \frac{e^{-b}}{\color{blue}{a}}}{y} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 7: 72.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := \frac{x \cdot e^{\log a \cdot t}}{y}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+49}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 360:\\
\;\;\;\;\frac{{z}^{y}}{a} \cdot \frac{x}{y}\\

\mathbf{elif}\;t\_1 \leq 10000000000:\\
\;\;\;\;\frac{x \cdot \frac{e^{-b}}{a}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -5.0000000000000004e49 or 1e10 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))

    1. Initial program 98.3%

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

      \[\leadsto \frac{x \cdot e^{\color{blue}{t \cdot \log a}}}{y} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{x \cdot e^{\log a \cdot \color{blue}{t}}}{y} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{x \cdot e^{\log a \cdot \color{blue}{t}}}{y} \]
      3. lift-log.f6448.2

        \[\leadsto \frac{x \cdot e^{\log a \cdot t}}{y} \]
    4. Applied rewrites48.2%

      \[\leadsto \frac{x \cdot e^{\color{blue}{\log a \cdot t}}}{y} \]

    if -5.0000000000000004e49 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 360

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in b around 0

      \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      5. lower-*.f6454.8

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    7. Applied rewrites54.8%

      \[\leadsto \frac{{z}^{y} \cdot x}{\color{blue}{a \cdot y}} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot \color{blue}{y}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      4. lift-pow.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      5. times-fracN/A

        \[\leadsto \frac{{z}^{y}}{a} \cdot \frac{x}{\color{blue}{y}} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{{z}^{y}}{a} \cdot \frac{x}{\color{blue}{y}} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{{z}^{y}}{a} \cdot \frac{x}{y} \]
      8. lift-pow.f64N/A

        \[\leadsto \frac{{z}^{y}}{a} \cdot \frac{x}{y} \]
      9. lower-/.f6455.2

        \[\leadsto \frac{{z}^{y}}{a} \cdot \frac{x}{y} \]
    9. Applied rewrites55.2%

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

    if 360 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 1e10

    1. Initial program 98.3%

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

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

        \[\leadsto \frac{x \cdot e^{-1 \cdot \log a + \left(y \cdot \log z - b\right)}}{y} \]
      2. exp-sumN/A

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

        \[\leadsto \frac{x \cdot \left(e^{\log a \cdot -1} \cdot e^{\color{blue}{y \cdot \log z} - b}\right)}{y} \]
      4. pow-to-expN/A

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{y \cdot \log z - b}\right)}{y} \]
      10. *-commutativeN/A

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

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
      12. lift-log.f6480.8

        \[\leadsto \frac{x \cdot \left(\frac{1}{a} \cdot e^{\log z \cdot y - b}\right)}{y} \]
    4. Applied rewrites80.8%

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

      \[\leadsto \frac{x \cdot \frac{e^{\mathsf{neg}\left(b\right)}}{\color{blue}{a}}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot \frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto \frac{x \cdot \frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.5

        \[\leadsto \frac{x \cdot \frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.5%

      \[\leadsto \frac{x \cdot \frac{e^{-b}}{\color{blue}{a}}}{y} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 72.8% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \frac{e^{-b}}{y}\\
\mathbf{if}\;b \leq -13500000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 780:\\
\;\;\;\;\frac{{z}^{y} \cdot x}{a \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -1.35e13 or 780 < b

    1. Initial program 98.3%

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

      \[\leadsto \frac{x \cdot e^{\color{blue}{-1 \cdot b}}}{y} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{x \cdot e^{\mathsf{neg}\left(b\right)}}{y} \]
      2. lower-neg.f6447.6

        \[\leadsto \frac{x \cdot e^{-b}}{y} \]
    4. Applied rewrites47.6%

      \[\leadsto \frac{x \cdot e^{\color{blue}{-b}}}{y} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot e^{-b}}{y}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot e^{-b}}}{y} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{e^{-b}}{y}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{e^{-b}}{y}} \]
      5. lower-/.f6447.6

        \[\leadsto x \cdot \color{blue}{\frac{e^{-b}}{y}} \]
    6. Applied rewrites47.6%

      \[\leadsto \color{blue}{x \cdot \frac{e^{-b}}{y}} \]

    if -1.35e13 < b < 780

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in b around 0

      \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      5. lower-*.f6454.8

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    7. Applied rewrites54.8%

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

Alternative 9: 59.4% accurate, 1.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{\mathsf{fma}\left(0.5 \cdot b - 1, b, 1\right)}{a}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 1.00000000000000005e248

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.1

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.1%

      \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]

    if 1.00000000000000005e248 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.1

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.1%

      \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    8. Taylor expanded in b around 0

      \[\leadsto x \cdot \frac{\frac{1 + b \cdot \left(\frac{1}{2} \cdot b - 1\right)}{a}}{y} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto x \cdot \frac{\frac{b \cdot \left(\frac{1}{2} \cdot b - 1\right) + 1}{a}}{y} \]
      2. *-commutativeN/A

        \[\leadsto x \cdot \frac{\frac{\left(\frac{1}{2} \cdot b - 1\right) \cdot b + 1}{a}}{y} \]
      3. lower-fma.f64N/A

        \[\leadsto x \cdot \frac{\frac{\mathsf{fma}\left(\frac{1}{2} \cdot b - 1, b, 1\right)}{a}}{y} \]
      4. lower--.f64N/A

        \[\leadsto x \cdot \frac{\frac{\mathsf{fma}\left(\frac{1}{2} \cdot b - 1, b, 1\right)}{a}}{y} \]
      5. lower-*.f6440.4

        \[\leadsto x \cdot \frac{\frac{\mathsf{fma}\left(0.5 \cdot b - 1, b, 1\right)}{a}}{y} \]
    10. Applied rewrites40.4%

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

Alternative 10: 58.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \frac{e^{-b}}{y}\\
\mathbf{if}\;b \leq -2550000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 520:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -2.55e12 or 520 < b

    1. Initial program 98.3%

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

      \[\leadsto \frac{x \cdot e^{\color{blue}{-1 \cdot b}}}{y} \]
    3. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{x \cdot e^{\mathsf{neg}\left(b\right)}}{y} \]
      2. lower-neg.f6447.6

        \[\leadsto \frac{x \cdot e^{-b}}{y} \]
    4. Applied rewrites47.6%

      \[\leadsto \frac{x \cdot e^{\color{blue}{-b}}}{y} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot e^{-b}}{y}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot e^{-b}}}{y} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{e^{-b}}{y}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{e^{-b}}{y}} \]
      5. lower-/.f6447.6

        \[\leadsto x \cdot \color{blue}{\frac{e^{-b}}{y}} \]
    6. Applied rewrites47.6%

      \[\leadsto \color{blue}{x \cdot \frac{e^{-b}}{y}} \]

    if -2.55e12 < b < 520

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.1

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.1%

      \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    8. Taylor expanded in b around 0

      \[\leadsto x \cdot \frac{\frac{1}{a}}{y} \]
    9. Step-by-step derivation
      1. lower-/.f6432.1

        \[\leadsto x \cdot \frac{\frac{1}{a}}{y} \]
    10. Applied rewrites32.1%

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

Alternative 11: 36.7% accurate, 2.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.4 \cdot 10^{-200}:\\
\;\;\;\;x \cdot \frac{\frac{\left(-b\right) + 1}{a}}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{a}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 6.39999999999999965e-200

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.1

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.1%

      \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    8. Taylor expanded in b around 0

      \[\leadsto x \cdot \frac{\frac{1 + -1 \cdot b}{a}}{y} \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto x \cdot \frac{\frac{1 + \left(\mathsf{neg}\left(b\right)\right)}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto x \cdot \frac{\frac{1 + \left(-b\right)}{a}}{y} \]
      3. +-commutativeN/A

        \[\leadsto x \cdot \frac{\frac{\left(-b\right) + 1}{a}}{y} \]
      4. lower-+.f6433.2

        \[\leadsto x \cdot \frac{\frac{\left(-b\right) + 1}{a}}{y} \]
    10. Applied rewrites33.2%

      \[\leadsto x \cdot \frac{\frac{\left(-b\right) + 1}{a}}{y} \]

    if 6.39999999999999965e-200 < b

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in b around 0

      \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      5. lower-*.f6454.8

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    7. Applied rewrites54.8%

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

      \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      2. lift-*.f6432.2

        \[\leadsto \frac{x}{a \cdot y} \]
    10. Applied rewrites32.2%

      \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{a}}{y} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\frac{x}{a}}{y} \]
      5. lower-/.f6432.3

        \[\leadsto \frac{\frac{x}{a}}{y} \]
    12. Applied rewrites32.3%

      \[\leadsto \frac{\frac{x}{a}}{y} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 32.3% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{-201}:\\
\;\;\;\;\frac{\frac{x}{a}}{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{a}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8.5000000000000007e-201

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in b around 0

      \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      5. lower-*.f6454.8

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    7. Applied rewrites54.8%

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

      \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      2. lift-*.f6432.2

        \[\leadsto \frac{x}{a \cdot y} \]
    10. Applied rewrites32.2%

      \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{a}}{y} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\frac{x}{a}}{y} \]
      5. lower-/.f6432.3

        \[\leadsto \frac{\frac{x}{a}}{y} \]
    12. Applied rewrites32.3%

      \[\leadsto \frac{\frac{x}{a}}{y} \]

    if 8.5000000000000007e-201 < y

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{\mathsf{neg}\left(b\right)}}{a}}{y} \]
      2. lift-neg.f64N/A

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
      3. lower-exp.f6459.1

        \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    7. Applied rewrites59.1%

      \[\leadsto x \cdot \frac{\frac{e^{-b}}{a}}{y} \]
    8. Taylor expanded in b around 0

      \[\leadsto x \cdot \frac{\frac{1}{a}}{y} \]
    9. Step-by-step derivation
      1. lower-/.f6432.1

        \[\leadsto x \cdot \frac{\frac{1}{a}}{y} \]
    10. Applied rewrites32.1%

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

Alternative 13: 32.2% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.2 \cdot 10^{-201}:\\
\;\;\;\;\frac{\frac{x}{a}}{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{a \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8.20000000000000003e-201

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in b around 0

      \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
      5. lower-*.f6454.8

        \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    7. Applied rewrites54.8%

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

      \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      2. lift-*.f6432.2

        \[\leadsto \frac{x}{a \cdot y} \]
    10. Applied rewrites32.2%

      \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{a \cdot y} \]
      3. associate-/r*N/A

        \[\leadsto \frac{\frac{x}{a}}{y} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\frac{x}{a}}{y} \]
      5. lower-/.f6432.3

        \[\leadsto \frac{\frac{x}{a}}{y} \]
    12. Applied rewrites32.3%

      \[\leadsto \frac{\frac{x}{a}}{y} \]

    if 8.20000000000000003e-201 < y

    1. Initial program 98.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
    5. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{e^{\mathsf{neg}\left(b\right)}}{\color{blue}{a \cdot y}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

        \[\leadsto x \cdot \frac{e^{-b}}{a \cdot y} \]
      3. lower-exp.f64N/A

        \[\leadsto x \cdot \frac{e^{-b}}{a \cdot y} \]
      4. lower-*.f6454.8

        \[\leadsto x \cdot \frac{e^{-b}}{a \cdot y} \]
    7. Applied rewrites54.8%

      \[\leadsto x \cdot \frac{e^{-b}}{\color{blue}{a \cdot y}} \]
    8. Taylor expanded in b around 0

      \[\leadsto x \cdot \frac{1}{a \cdot \color{blue}{y}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x \cdot \frac{1}{a \cdot y} \]
      2. lift-*.f6432.3

        \[\leadsto x \cdot \frac{1}{a \cdot y} \]
    10. Applied rewrites32.3%

      \[\leadsto x \cdot \frac{1}{a \cdot \color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 32.0% accurate, 5.5× speedup?

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

\\
\frac{\frac{x}{a}}{y}
\end{array}
Derivation
  1. Initial program 98.3%

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
  5. Taylor expanded in b around 0

    \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
  6. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    4. lower-pow.f64N/A

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    5. lower-*.f6454.8

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
  7. Applied rewrites54.8%

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

    \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
  9. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{x}{a \cdot y} \]
    2. lift-*.f6432.2

      \[\leadsto \frac{x}{a \cdot y} \]
  10. Applied rewrites32.2%

    \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
  11. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{x}{a \cdot y} \]
    2. lift-/.f64N/A

      \[\leadsto \frac{x}{a \cdot y} \]
    3. associate-/r*N/A

      \[\leadsto \frac{\frac{x}{a}}{y} \]
    4. lower-/.f64N/A

      \[\leadsto \frac{\frac{x}{a}}{y} \]
    5. lower-/.f6432.3

      \[\leadsto \frac{\frac{x}{a}}{y} \]
  12. Applied rewrites32.3%

    \[\leadsto \frac{\frac{x}{a}}{y} \]
  13. Add Preprocessing

Alternative 15: 31.8% accurate, 5.8× speedup?

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

\\
\frac{x}{a \cdot y}
\end{array}
Derivation
  1. Initial program 98.3%

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{a} \cdot e^{\log z \cdot y - b}}{y}} \]
  5. Taylor expanded in b around 0

    \[\leadsto \frac{x \cdot {z}^{y}}{\color{blue}{a \cdot y}} \]
  6. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{x \cdot {z}^{y}}{a \cdot \color{blue}{y}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    3. lower-*.f64N/A

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    4. lower-pow.f64N/A

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
    5. lower-*.f6454.8

      \[\leadsto \frac{{z}^{y} \cdot x}{a \cdot y} \]
  7. Applied rewrites54.8%

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

    \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
  9. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{x}{a \cdot y} \]
    2. lift-*.f6432.2

      \[\leadsto \frac{x}{a \cdot y} \]
  10. Applied rewrites32.2%

    \[\leadsto \frac{x}{a \cdot \color{blue}{y}} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2025139 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
  :precision binary64
  (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))