Octave 3.8, jcobi/3

Percentage Accurate: 94.8% → 99.6%
Time: 9.6s
Alternatives: 16
Speedup: 2.6×

Specification

?
\[\alpha > -1 \land \beta > -1\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\ \frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t\_0}}{t\_0}}{t\_0 + 1} \end{array} \end{array} \]
(FPCore (alpha beta)
 :precision binary64
 (let* ((t_0 (+ (+ alpha beta) (* 2.0 1.0))))
   (/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) t_0) t_0) (+ t_0 1.0))))
double code(double alpha, double beta) {
	double t_0 = (alpha + beta) + (2.0 * 1.0);
	return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
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(alpha, beta)
use fmin_fmax_functions
    real(8), intent (in) :: alpha
    real(8), intent (in) :: beta
    real(8) :: t_0
    t_0 = (alpha + beta) + (2.0d0 * 1.0d0)
    code = (((((alpha + beta) + (beta * alpha)) + 1.0d0) / t_0) / t_0) / (t_0 + 1.0d0)
end function
public static double code(double alpha, double beta) {
	double t_0 = (alpha + beta) + (2.0 * 1.0);
	return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
def code(alpha, beta):
	t_0 = (alpha + beta) + (2.0 * 1.0)
	return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0)
function code(alpha, beta)
	t_0 = Float64(Float64(alpha + beta) + Float64(2.0 * 1.0))
	return Float64(Float64(Float64(Float64(Float64(Float64(alpha + beta) + Float64(beta * alpha)) + 1.0) / t_0) / t_0) / Float64(t_0 + 1.0))
end
function tmp = code(alpha, beta)
	t_0 = (alpha + beta) + (2.0 * 1.0);
	tmp = (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(alpha + beta), $MachinePrecision] + N[(beta * alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\
\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t\_0}}{t\_0}}{t\_0 + 1}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 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: 94.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\ \frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t\_0}}{t\_0}}{t\_0 + 1} \end{array} \end{array} \]
(FPCore (alpha beta)
 :precision binary64
 (let* ((t_0 (+ (+ alpha beta) (* 2.0 1.0))))
   (/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) t_0) t_0) (+ t_0 1.0))))
double code(double alpha, double beta) {
	double t_0 = (alpha + beta) + (2.0 * 1.0);
	return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
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(alpha, beta)
use fmin_fmax_functions
    real(8), intent (in) :: alpha
    real(8), intent (in) :: beta
    real(8) :: t_0
    t_0 = (alpha + beta) + (2.0d0 * 1.0d0)
    code = (((((alpha + beta) + (beta * alpha)) + 1.0d0) / t_0) / t_0) / (t_0 + 1.0d0)
end function
public static double code(double alpha, double beta) {
	double t_0 = (alpha + beta) + (2.0 * 1.0);
	return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
def code(alpha, beta):
	t_0 = (alpha + beta) + (2.0 * 1.0)
	return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0)
function code(alpha, beta)
	t_0 = Float64(Float64(alpha + beta) + Float64(2.0 * 1.0))
	return Float64(Float64(Float64(Float64(Float64(Float64(alpha + beta) + Float64(beta * alpha)) + 1.0) / t_0) / t_0) / Float64(t_0 + 1.0))
end
function tmp = code(alpha, beta)
	t_0 = (alpha + beta) + (2.0 * 1.0);
	tmp = (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(alpha + beta), $MachinePrecision] + N[(beta * alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\
\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t\_0}}{t\_0}}{t\_0 + 1}
\end{array}
\end{array}

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} t_0 := \left(\beta + \alpha\right) + 2\\ \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{t\_0}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\left(\frac{1 + \alpha}{\beta} + \alpha\right) + 1\right) - \left(1 + \alpha\right) \cdot \frac{\mathsf{fma}\left(2, \alpha, 5\right)}{\beta}}{\beta}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
 :precision binary64
 (let* ((t_0 (+ (+ beta alpha) 2.0)))
   (if (<= beta 1.05e+20)
     (/
      (/ (+ (fma beta alpha (+ beta alpha)) 1.0) t_0)
      (* (+ 3.0 (+ beta alpha)) t_0))
     (/
      (/
       (-
        (+ (+ (/ (+ 1.0 alpha) beta) alpha) 1.0)
        (* (+ 1.0 alpha) (/ (fma 2.0 alpha 5.0) beta)))
       beta)
      (+ (+ 2.0 alpha) beta)))))
assert(alpha < beta);
double code(double alpha, double beta) {
	double t_0 = (beta + alpha) + 2.0;
	double tmp;
	if (beta <= 1.05e+20) {
		tmp = ((fma(beta, alpha, (beta + alpha)) + 1.0) / t_0) / ((3.0 + (beta + alpha)) * t_0);
	} else {
		tmp = ((((((1.0 + alpha) / beta) + alpha) + 1.0) - ((1.0 + alpha) * (fma(2.0, alpha, 5.0) / beta))) / beta) / ((2.0 + alpha) + beta);
	}
	return tmp;
}
alpha, beta = sort([alpha, beta])
function code(alpha, beta)
	t_0 = Float64(Float64(beta + alpha) + 2.0)
	tmp = 0.0
	if (beta <= 1.05e+20)
		tmp = Float64(Float64(Float64(fma(beta, alpha, Float64(beta + alpha)) + 1.0) / t_0) / Float64(Float64(3.0 + Float64(beta + alpha)) * t_0));
	else
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(1.0 + alpha) / beta) + alpha) + 1.0) - Float64(Float64(1.0 + alpha) * Float64(fma(2.0, alpha, 5.0) / beta))) / beta) / Float64(Float64(2.0 + alpha) + beta));
	end
	return tmp
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[beta, 1.05e+20], N[(N[(N[(N[(beta * alpha + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(N[(3.0 + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] + alpha), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(1.0 + alpha), $MachinePrecision] * N[(N[(2.0 * alpha + 5.0), $MachinePrecision] / beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / beta), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \left(\beta + \alpha\right) + 2\\
\mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{t\_0}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\left(\frac{1 + \alpha}{\beta} + \alpha\right) + 1\right) - \left(1 + \alpha\right) \cdot \frac{\mathsf{fma}\left(2, \alpha, 5\right)}{\beta}}{\beta}}{\left(2 + \alpha\right) + \beta}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if beta < 1.05e20

    1. Initial program 99.9%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
    4. Applied rewrites99.3%

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]

    if 1.05e20 < beta

    1. Initial program 76.6%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Taylor expanded in beta around -inf

      \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      4. mul-1-negN/A

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      5. lower-neg.f6480.5

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    5. Applied rewrites80.5%

      \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
    7. Applied rewrites80.5%

      \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
    8. Taylor expanded in beta around inf

      \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(\alpha + \left(\frac{1}{\beta} + \frac{\alpha}{\beta}\right)\right)\right) - \frac{\left(1 + \alpha\right) \cdot \left(5 + 2 \cdot \alpha\right)}{\beta}}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\left(1 + \left(\alpha + \left(\frac{1}{\beta} + \frac{\alpha}{\beta}\right)\right)\right) - \frac{\left(1 + \alpha\right) \cdot \left(5 + 2 \cdot \alpha\right)}{\beta}}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
    10. Applied rewrites79.2%

      \[\leadsto \frac{\color{blue}{\frac{\left(\left(\frac{1 + \alpha}{\beta} + \alpha\right) + 1\right) - \left(1 + \alpha\right) \cdot \frac{\mathsf{fma}\left(2, \alpha, 5\right)}{\beta}}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.5% accurate, 1.3× speedup?

\[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} t_0 := \left(\beta + \alpha\right) + 2\\ \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{t\_0}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
 :precision binary64
 (let* ((t_0 (+ (+ beta alpha) 2.0)))
   (if (<= beta 1.05e+20)
     (/
      (/ (+ (fma beta alpha (+ beta alpha)) 1.0) t_0)
      (* (+ 3.0 (+ beta alpha)) t_0))
     (/ (/ (- alpha -1.0) (+ (+ alpha beta) 3.0)) (+ (+ 2.0 alpha) beta)))))
assert(alpha < beta);
double code(double alpha, double beta) {
	double t_0 = (beta + alpha) + 2.0;
	double tmp;
	if (beta <= 1.05e+20) {
		tmp = ((fma(beta, alpha, (beta + alpha)) + 1.0) / t_0) / ((3.0 + (beta + alpha)) * t_0);
	} else {
		tmp = ((alpha - -1.0) / ((alpha + beta) + 3.0)) / ((2.0 + alpha) + beta);
	}
	return tmp;
}
alpha, beta = sort([alpha, beta])
function code(alpha, beta)
	t_0 = Float64(Float64(beta + alpha) + 2.0)
	tmp = 0.0
	if (beta <= 1.05e+20)
		tmp = Float64(Float64(Float64(fma(beta, alpha, Float64(beta + alpha)) + 1.0) / t_0) / Float64(Float64(3.0 + Float64(beta + alpha)) * t_0));
	else
		tmp = Float64(Float64(Float64(alpha - -1.0) / Float64(Float64(alpha + beta) + 3.0)) / Float64(Float64(2.0 + alpha) + beta));
	end
	return tmp
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[beta, 1.05e+20], N[(N[(N[(N[(beta * alpha + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(N[(3.0 + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(alpha - -1.0), $MachinePrecision] / N[(N[(alpha + beta), $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \left(\beta + \alpha\right) + 2\\
\mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{t\_0}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if beta < 1.05e20

    1. Initial program 99.9%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
    4. Applied rewrites99.3%

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]

    if 1.05e20 < beta

    1. Initial program 76.6%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Taylor expanded in beta around -inf

      \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      4. mul-1-negN/A

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      5. lower-neg.f6480.5

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    5. Applied rewrites80.5%

      \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
    7. Applied rewrites80.5%

      \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.5% accurate, 1.4× speedup?

\[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} t_0 := \left(\beta + \alpha\right) + 2\\ \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{t\_0 \cdot \left(\left(\left(1 + \left(\alpha + \beta\right)\right) + 2\right) \cdot t\_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
 :precision binary64
 (let* ((t_0 (+ (+ beta alpha) 2.0)))
   (if (<= beta 1.05e+20)
     (/
      (+ (fma beta alpha (+ beta alpha)) 1.0)
      (* t_0 (* (+ (+ 1.0 (+ alpha beta)) 2.0) t_0)))
     (/ (/ (- alpha -1.0) (+ (+ alpha beta) 3.0)) (+ (+ 2.0 alpha) beta)))))
assert(alpha < beta);
double code(double alpha, double beta) {
	double t_0 = (beta + alpha) + 2.0;
	double tmp;
	if (beta <= 1.05e+20) {
		tmp = (fma(beta, alpha, (beta + alpha)) + 1.0) / (t_0 * (((1.0 + (alpha + beta)) + 2.0) * t_0));
	} else {
		tmp = ((alpha - -1.0) / ((alpha + beta) + 3.0)) / ((2.0 + alpha) + beta);
	}
	return tmp;
}
alpha, beta = sort([alpha, beta])
function code(alpha, beta)
	t_0 = Float64(Float64(beta + alpha) + 2.0)
	tmp = 0.0
	if (beta <= 1.05e+20)
		tmp = Float64(Float64(fma(beta, alpha, Float64(beta + alpha)) + 1.0) / Float64(t_0 * Float64(Float64(Float64(1.0 + Float64(alpha + beta)) + 2.0) * t_0)));
	else
		tmp = Float64(Float64(Float64(alpha - -1.0) / Float64(Float64(alpha + beta) + 3.0)) / Float64(Float64(2.0 + alpha) + beta));
	end
	return tmp
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[beta, 1.05e+20], N[(N[(N[(beta * alpha + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(t$95$0 * N[(N[(N[(1.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(alpha - -1.0), $MachinePrecision] / N[(N[(alpha + beta), $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \left(\beta + \alpha\right) + 2\\
\mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{t\_0 \cdot \left(\left(\left(1 + \left(\alpha + \beta\right)\right) + 2\right) \cdot t\_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if beta < 1.05e20

    1. Initial program 99.9%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)} \]
      5. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)\right)}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)\right)}} \]
    4. Applied rewrites94.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\color{blue}{\left(3 + \left(\beta + \alpha\right)\right)} \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      2. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\color{blue}{\left(1 + 2\right)} + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      3. associate-+r+N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\color{blue}{\left(1 + \left(2 + \left(\beta + \alpha\right)\right)\right)} \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(1 + \color{blue}{\left(\left(\beta + \alpha\right) + 2\right)}\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      5. associate-+r+N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\color{blue}{\left(\left(1 + \left(\beta + \alpha\right)\right) + 2\right)} \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\color{blue}{\left(\left(\beta + \alpha\right) + 1\right)} + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(\left(\beta + \alpha\right) + \color{blue}{\left(2 - 1\right)}\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      8. associate--l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\color{blue}{\left(\left(\left(\beta + \alpha\right) + 2\right) - 1\right)} + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(\left(\color{blue}{\left(\beta + \alpha\right)} + 2\right) - 1\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(\left(\color{blue}{\left(\alpha + \beta\right)} + 2\right) - 1\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\color{blue}{\left(\left(\left(\left(\alpha + \beta\right) + 2\right) - 1\right) + 2\right)} \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      12. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(\left(\color{blue}{\left(\beta + \alpha\right)} + 2\right) - 1\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      13. lift-+.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(\left(\color{blue}{\left(\beta + \alpha\right)} + 2\right) - 1\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      14. associate--l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\color{blue}{\left(\left(\beta + \alpha\right) + \left(2 - 1\right)\right)} + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      15. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(\left(\beta + \alpha\right) + \color{blue}{1}\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      16. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\color{blue}{\left(1 + \left(\beta + \alpha\right)\right)} + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      17. lower-+.f6494.2

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\color{blue}{\left(1 + \left(\beta + \alpha\right)\right)} + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(1 + \color{blue}{\left(\beta + \alpha\right)}\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(1 + \color{blue}{\left(\alpha + \beta\right)}\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      20. lower-+.f6494.2

        \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(1 + \color{blue}{\left(\alpha + \beta\right)}\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
    6. Applied rewrites94.2%

      \[\leadsto \frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\color{blue}{\left(\left(1 + \left(\alpha + \beta\right)\right) + 2\right)} \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]

    if 1.05e20 < beta

    1. Initial program 76.6%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Taylor expanded in beta around -inf

      \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      4. mul-1-negN/A

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      5. lower-neg.f6480.5

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    5. Applied rewrites80.5%

      \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
    7. Applied rewrites80.5%

      \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(\left(1 + \left(\alpha + \beta\right)\right) + 2\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.5% accurate, 1.4× speedup?

\[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} t_0 := \left(\beta + \alpha\right) + 2\\ \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\alpha, \beta, 1\right) + \left(\alpha + \beta\right)}{t\_0 \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot t\_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
 :precision binary64
 (let* ((t_0 (+ (+ beta alpha) 2.0)))
   (if (<= beta 1.05e+20)
     (/
      (+ (fma alpha beta 1.0) (+ alpha beta))
      (* t_0 (* (+ 3.0 (+ beta alpha)) t_0)))
     (/ (/ (- alpha -1.0) (+ (+ alpha beta) 3.0)) (+ (+ 2.0 alpha) beta)))))
assert(alpha < beta);
double code(double alpha, double beta) {
	double t_0 = (beta + alpha) + 2.0;
	double tmp;
	if (beta <= 1.05e+20) {
		tmp = (fma(alpha, beta, 1.0) + (alpha + beta)) / (t_0 * ((3.0 + (beta + alpha)) * t_0));
	} else {
		tmp = ((alpha - -1.0) / ((alpha + beta) + 3.0)) / ((2.0 + alpha) + beta);
	}
	return tmp;
}
alpha, beta = sort([alpha, beta])
function code(alpha, beta)
	t_0 = Float64(Float64(beta + alpha) + 2.0)
	tmp = 0.0
	if (beta <= 1.05e+20)
		tmp = Float64(Float64(fma(alpha, beta, 1.0) + Float64(alpha + beta)) / Float64(t_0 * Float64(Float64(3.0 + Float64(beta + alpha)) * t_0)));
	else
		tmp = Float64(Float64(Float64(alpha - -1.0) / Float64(Float64(alpha + beta) + 3.0)) / Float64(Float64(2.0 + alpha) + beta));
	end
	return tmp
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[beta, 1.05e+20], N[(N[(N[(alpha * beta + 1.0), $MachinePrecision] + N[(alpha + beta), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(N[(3.0 + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(alpha - -1.0), $MachinePrecision] / N[(N[(alpha + beta), $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \left(\beta + \alpha\right) + 2\\
\mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\alpha, \beta, 1\right) + \left(\alpha + \beta\right)}{t\_0 \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot t\_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if beta < 1.05e20

    1. Initial program 99.9%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)} \]
      5. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)\right)}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)\right)}} \]
    4. Applied rewrites94.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{1 + \mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      3. lift-fma.f64N/A

        \[\leadsto \frac{1 + \color{blue}{\left(\beta \cdot \alpha + \left(\beta + \alpha\right)\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      4. associate-+r+N/A

        \[\leadsto \frac{\color{blue}{\left(1 + \beta \cdot \alpha\right) + \left(\beta + \alpha\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(\beta \cdot \alpha + 1\right)} + \left(\beta + \alpha\right)}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\beta, \alpha, 1\right)} + \left(\beta + \alpha\right)}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      7. lower-+.f6494.2

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\beta, \alpha, 1\right) + \left(\beta + \alpha\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\left(\beta \cdot \alpha + 1\right)} + \left(\beta + \alpha\right)}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\left(\color{blue}{\alpha \cdot \beta} + 1\right) + \left(\beta + \alpha\right)}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      10. lower-fma.f6494.2

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\alpha, \beta, 1\right)} + \left(\beta + \alpha\right)}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      11. lift-+.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\alpha, \beta, 1\right) + \color{blue}{\left(\beta + \alpha\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      12. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\alpha, \beta, 1\right) + \color{blue}{\left(\alpha + \beta\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
      13. lower-+.f6494.2

        \[\leadsto \frac{\mathsf{fma}\left(\alpha, \beta, 1\right) + \color{blue}{\left(\alpha + \beta\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]
    6. Applied rewrites94.2%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\alpha, \beta, 1\right) + \left(\alpha + \beta\right)}}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)} \]

    if 1.05e20 < beta

    1. Initial program 76.6%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Taylor expanded in beta around -inf

      \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      4. mul-1-negN/A

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      5. lower-neg.f6480.5

        \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    5. Applied rewrites80.5%

      \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
    7. Applied rewrites80.5%

      \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+20}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\alpha, \beta, 1\right) + \left(\alpha + \beta\right)}{\left(\left(\beta + \alpha\right) + 2\right) \cdot \left(\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 98.4% accurate, 1.9× speedup?

\[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+16}:\\ \;\;\;\;\frac{\frac{1 + \beta}{2 + \beta}}{\mathsf{fma}\left(5 + \beta, \beta, 6\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
 :precision binary64
 (if (<= beta 1.05e+16)
   (/ (/ (+ 1.0 beta) (+ 2.0 beta)) (fma (+ 5.0 beta) beta 6.0))
   (/ (/ (- alpha -1.0) (+ (+ alpha beta) 3.0)) (+ (+ 2.0 alpha) beta))))
assert(alpha < beta);
double code(double alpha, double beta) {
	double tmp;
	if (beta <= 1.05e+16) {
		tmp = ((1.0 + beta) / (2.0 + beta)) / fma((5.0 + beta), beta, 6.0);
	} else {
		tmp = ((alpha - -1.0) / ((alpha + beta) + 3.0)) / ((2.0 + alpha) + beta);
	}
	return tmp;
}
alpha, beta = sort([alpha, beta])
function code(alpha, beta)
	tmp = 0.0
	if (beta <= 1.05e+16)
		tmp = Float64(Float64(Float64(1.0 + beta) / Float64(2.0 + beta)) / fma(Float64(5.0 + beta), beta, 6.0));
	else
		tmp = Float64(Float64(Float64(alpha - -1.0) / Float64(Float64(alpha + beta) + 3.0)) / Float64(Float64(2.0 + alpha) + beta));
	end
	return tmp
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := If[LessEqual[beta, 1.05e+16], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(2.0 + beta), $MachinePrecision]), $MachinePrecision] / N[(N[(5.0 + beta), $MachinePrecision] * beta + 6.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(alpha - -1.0), $MachinePrecision] / N[(N[(alpha + beta), $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.05 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{1 + \beta}{2 + \beta}}{\mathsf{fma}\left(5 + \beta, \beta, 6\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if beta < 1.05e16

    1. Initial program 99.9%

      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      3. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
    4. Applied rewrites99.3%

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]
    5. Taylor expanded in alpha around 0

      \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{1 + \beta}}{2 + \beta}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
      3. lower-+.f6486.5

        \[\leadsto \frac{\frac{1 + \beta}{\color{blue}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
    7. Applied rewrites86.5%

      \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
    8. Taylor expanded in alpha around 0

      \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(2 + \beta\right) \cdot \left(3 + \beta\right)}} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
      3. lower-+.f64N/A

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right)} \cdot \left(2 + \beta\right)} \]
      4. lower-+.f6468.4

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\left(3 + \beta\right) \cdot \color{blue}{\left(2 + \beta\right)}} \]
    10. Applied rewrites68.4%

      \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
    11. Taylor expanded in beta around 0

      \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{6 + \color{blue}{\beta \cdot \left(5 + \beta\right)}} \]
    12. Step-by-step derivation
      1. Applied rewrites68.4%

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\mathsf{fma}\left(5 + \beta, \color{blue}{\beta}, 6\right)} \]

      if 1.05e16 < beta

      1. Initial program 76.9%

        \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      2. Add Preprocessing
      3. Taylor expanded in beta around -inf

        \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        2. lower-neg.f64N/A

          \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        3. lower--.f64N/A

          \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        5. lower-neg.f6479.6

          \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      5. Applied rewrites79.6%

        \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      6. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
        2. lift-/.f64N/A

          \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        3. associate-/l/N/A

          \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
      7. Applied rewrites79.6%

        \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
    13. Recombined 2 regimes into one program.
    14. Final simplification71.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\beta \leq 1.05 \cdot 10^{+16}:\\ \;\;\;\;\frac{\frac{1 + \beta}{2 + \beta}}{\mathsf{fma}\left(5 + \beta, \beta, 6\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha - -1}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \]
    15. Add Preprocessing

    Alternative 6: 98.4% accurate, 1.9× speedup?

    \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 4.4 \cdot 10^{+19}:\\ \;\;\;\;\frac{\frac{1 + \beta}{2 + \beta}}{\mathsf{fma}\left(5 + \beta, \beta, 6\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
    NOTE: alpha and beta should be sorted in increasing order before calling this function.
    (FPCore (alpha beta)
     :precision binary64
     (if (<= beta 4.4e+19)
       (/ (/ (+ 1.0 beta) (+ 2.0 beta)) (fma (+ 5.0 beta) beta 6.0))
       (/ (/ (+ 1.0 alpha) beta) (+ (+ 2.0 alpha) beta))))
    assert(alpha < beta);
    double code(double alpha, double beta) {
    	double tmp;
    	if (beta <= 4.4e+19) {
    		tmp = ((1.0 + beta) / (2.0 + beta)) / fma((5.0 + beta), beta, 6.0);
    	} else {
    		tmp = ((1.0 + alpha) / beta) / ((2.0 + alpha) + beta);
    	}
    	return tmp;
    }
    
    alpha, beta = sort([alpha, beta])
    function code(alpha, beta)
    	tmp = 0.0
    	if (beta <= 4.4e+19)
    		tmp = Float64(Float64(Float64(1.0 + beta) / Float64(2.0 + beta)) / fma(Float64(5.0 + beta), beta, 6.0));
    	else
    		tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(Float64(2.0 + alpha) + beta));
    	end
    	return tmp
    end
    
    NOTE: alpha and beta should be sorted in increasing order before calling this function.
    code[alpha_, beta_] := If[LessEqual[beta, 4.4e+19], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(2.0 + beta), $MachinePrecision]), $MachinePrecision] / N[(N[(5.0 + beta), $MachinePrecision] * beta + 6.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    [alpha, beta] = \mathsf{sort}([alpha, beta])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;\beta \leq 4.4 \cdot 10^{+19}:\\
    \;\;\;\;\frac{\frac{1 + \beta}{2 + \beta}}{\mathsf{fma}\left(5 + \beta, \beta, 6\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\left(2 + \alpha\right) + \beta}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if beta < 4.4e19

      1. Initial program 99.9%

        \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
        2. lift-/.f64N/A

          \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        3. associate-/l/N/A

          \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
      4. Applied rewrites99.3%

        \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]
      5. Taylor expanded in alpha around 0

        \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
      6. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
        2. lower-+.f64N/A

          \[\leadsto \frac{\frac{\color{blue}{1 + \beta}}{2 + \beta}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
        3. lower-+.f6486.6

          \[\leadsto \frac{\frac{1 + \beta}{\color{blue}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
      7. Applied rewrites86.6%

        \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
      8. Taylor expanded in alpha around 0

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(2 + \beta\right) \cdot \left(3 + \beta\right)}} \]
      9. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
        3. lower-+.f64N/A

          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right)} \cdot \left(2 + \beta\right)} \]
        4. lower-+.f6468.0

          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\left(3 + \beta\right) \cdot \color{blue}{\left(2 + \beta\right)}} \]
      10. Applied rewrites68.0%

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
      11. Taylor expanded in beta around 0

        \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{6 + \color{blue}{\beta \cdot \left(5 + \beta\right)}} \]
      12. Step-by-step derivation
        1. Applied rewrites68.0%

          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\mathsf{fma}\left(5 + \beta, \color{blue}{\beta}, 6\right)} \]

        if 4.4e19 < beta

        1. Initial program 76.6%

          \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        2. Add Preprocessing
        3. Taylor expanded in beta around -inf

          \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        4. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          2. lower-neg.f64N/A

            \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          3. lower--.f64N/A

            \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          4. mul-1-negN/A

            \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          5. lower-neg.f6480.5

            \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        5. Applied rewrites80.5%

          \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        6. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          3. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
        7. Applied rewrites80.5%

          \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
        8. Taylor expanded in beta around inf

          \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
        9. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
          2. lower-+.f6479.5

            \[\leadsto \frac{\frac{\color{blue}{1 + \alpha}}{\beta}}{\left(2 + \alpha\right) + \beta} \]
        10. Applied rewrites79.5%

          \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
      13. Recombined 2 regimes into one program.
      14. Add Preprocessing

      Alternative 7: 97.3% accurate, 2.0× speedup?

      \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 2.55:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.125, \beta, 0.25\right), \beta, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
      NOTE: alpha and beta should be sorted in increasing order before calling this function.
      (FPCore (alpha beta)
       :precision binary64
       (if (<= beta 2.55)
         (/ (fma (fma -0.125 beta 0.25) beta 0.5) (* (+ 3.0 beta) (+ 2.0 beta)))
         (/ (/ (+ 1.0 alpha) beta) (+ (+ 2.0 alpha) beta))))
      assert(alpha < beta);
      double code(double alpha, double beta) {
      	double tmp;
      	if (beta <= 2.55) {
      		tmp = fma(fma(-0.125, beta, 0.25), beta, 0.5) / ((3.0 + beta) * (2.0 + beta));
      	} else {
      		tmp = ((1.0 + alpha) / beta) / ((2.0 + alpha) + beta);
      	}
      	return tmp;
      }
      
      alpha, beta = sort([alpha, beta])
      function code(alpha, beta)
      	tmp = 0.0
      	if (beta <= 2.55)
      		tmp = Float64(fma(fma(-0.125, beta, 0.25), beta, 0.5) / Float64(Float64(3.0 + beta) * Float64(2.0 + beta)));
      	else
      		tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(Float64(2.0 + alpha) + beta));
      	end
      	return tmp
      end
      
      NOTE: alpha and beta should be sorted in increasing order before calling this function.
      code[alpha_, beta_] := If[LessEqual[beta, 2.55], N[(N[(N[(-0.125 * beta + 0.25), $MachinePrecision] * beta + 0.5), $MachinePrecision] / N[(N[(3.0 + beta), $MachinePrecision] * N[(2.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      [alpha, beta] = \mathsf{sort}([alpha, beta])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;\beta \leq 2.55:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.125, \beta, 0.25\right), \beta, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\left(2 + \alpha\right) + \beta}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if beta < 2.5499999999999998

        1. Initial program 99.9%

          \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          3. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
          4. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
        4. Applied rewrites99.3%

          \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]
        5. Taylor expanded in alpha around 0

          \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
        6. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
          2. lower-+.f64N/A

            \[\leadsto \frac{\frac{\color{blue}{1 + \beta}}{2 + \beta}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
          3. lower-+.f6486.8

            \[\leadsto \frac{\frac{1 + \beta}{\color{blue}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
        7. Applied rewrites86.8%

          \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
        8. Taylor expanded in alpha around 0

          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(2 + \beta\right) \cdot \left(3 + \beta\right)}} \]
        9. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
          3. lower-+.f64N/A

            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right)} \cdot \left(2 + \beta\right)} \]
          4. lower-+.f6468.9

            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\left(3 + \beta\right) \cdot \color{blue}{\left(2 + \beta\right)}} \]
        10. Applied rewrites68.9%

          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
        11. Taylor expanded in beta around 0

          \[\leadsto \frac{\frac{1}{2} + \color{blue}{\beta \cdot \left(\frac{1}{4} + \frac{-1}{8} \cdot \beta\right)}}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)} \]
        12. Step-by-step derivation
          1. Applied rewrites68.3%

            \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.125, \beta, 0.25\right), \color{blue}{\beta}, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)} \]

          if 2.5499999999999998 < beta

          1. Initial program 77.7%

            \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          2. Add Preprocessing
          3. Taylor expanded in beta around -inf

            \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          4. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            2. lower-neg.f64N/A

              \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            3. lower--.f64N/A

              \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            4. mul-1-negN/A

              \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            5. lower-neg.f6477.8

              \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          5. Applied rewrites77.8%

            \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          6. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
            2. lift-/.f64N/A

              \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            3. associate-/l/N/A

              \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
          7. Applied rewrites77.8%

            \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
          8. Taylor expanded in beta around inf

            \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
          9. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
            2. lower-+.f6476.7

              \[\leadsto \frac{\frac{\color{blue}{1 + \alpha}}{\beta}}{\left(2 + \alpha\right) + \beta} \]
          10. Applied rewrites76.7%

            \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
        13. Recombined 2 regimes into one program.
        14. Add Preprocessing

        Alternative 8: 97.2% accurate, 2.2× speedup?

        \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 4.7:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.25, \beta, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\left(2 + \alpha\right) + \beta}\\ \end{array} \end{array} \]
        NOTE: alpha and beta should be sorted in increasing order before calling this function.
        (FPCore (alpha beta)
         :precision binary64
         (if (<= beta 4.7)
           (/ (fma 0.25 beta 0.5) (* (+ 3.0 beta) (+ 2.0 beta)))
           (/ (/ (+ 1.0 alpha) beta) (+ (+ 2.0 alpha) beta))))
        assert(alpha < beta);
        double code(double alpha, double beta) {
        	double tmp;
        	if (beta <= 4.7) {
        		tmp = fma(0.25, beta, 0.5) / ((3.0 + beta) * (2.0 + beta));
        	} else {
        		tmp = ((1.0 + alpha) / beta) / ((2.0 + alpha) + beta);
        	}
        	return tmp;
        }
        
        alpha, beta = sort([alpha, beta])
        function code(alpha, beta)
        	tmp = 0.0
        	if (beta <= 4.7)
        		tmp = Float64(fma(0.25, beta, 0.5) / Float64(Float64(3.0 + beta) * Float64(2.0 + beta)));
        	else
        		tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(Float64(2.0 + alpha) + beta));
        	end
        	return tmp
        end
        
        NOTE: alpha and beta should be sorted in increasing order before calling this function.
        code[alpha_, beta_] := If[LessEqual[beta, 4.7], N[(N[(0.25 * beta + 0.5), $MachinePrecision] / N[(N[(3.0 + beta), $MachinePrecision] * N[(2.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + beta), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        [alpha, beta] = \mathsf{sort}([alpha, beta])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;\beta \leq 4.7:\\
        \;\;\;\;\frac{\mathsf{fma}\left(0.25, \beta, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\left(2 + \alpha\right) + \beta}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if beta < 4.70000000000000018

          1. Initial program 99.9%

            \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
            2. lift-/.f64N/A

              \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            3. associate-/l/N/A

              \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
            4. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
          4. Applied rewrites99.3%

            \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]
          5. Taylor expanded in alpha around 0

            \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
          6. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
            2. lower-+.f64N/A

              \[\leadsto \frac{\frac{\color{blue}{1 + \beta}}{2 + \beta}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
            3. lower-+.f6486.8

              \[\leadsto \frac{\frac{1 + \beta}{\color{blue}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
          7. Applied rewrites86.8%

            \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
          8. Taylor expanded in alpha around 0

            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(2 + \beta\right) \cdot \left(3 + \beta\right)}} \]
          9. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
            2. lower-*.f64N/A

              \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
            3. lower-+.f64N/A

              \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right)} \cdot \left(2 + \beta\right)} \]
            4. lower-+.f6468.9

              \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\left(3 + \beta\right) \cdot \color{blue}{\left(2 + \beta\right)}} \]
          10. Applied rewrites68.9%

            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
          11. Taylor expanded in beta around 0

            \[\leadsto \frac{\frac{1}{2} + \color{blue}{\frac{1}{4} \cdot \beta}}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)} \]
          12. Step-by-step derivation
            1. Applied rewrites67.9%

              \[\leadsto \frac{\mathsf{fma}\left(0.25, \color{blue}{\beta}, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)} \]

            if 4.70000000000000018 < beta

            1. Initial program 77.7%

              \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            2. Add Preprocessing
            3. Taylor expanded in beta around -inf

              \[\leadsto \frac{\frac{\color{blue}{-1 \cdot \left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            4. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto \frac{\frac{\color{blue}{\mathsf{neg}\left(\left(-1 \cdot \alpha - 1\right)\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
              2. lower-neg.f64N/A

                \[\leadsto \frac{\frac{\color{blue}{-\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
              3. lower--.f64N/A

                \[\leadsto \frac{\frac{-\color{blue}{\left(-1 \cdot \alpha - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
              4. mul-1-negN/A

                \[\leadsto \frac{\frac{-\left(\color{blue}{\left(\mathsf{neg}\left(\alpha\right)\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
              5. lower-neg.f6477.8

                \[\leadsto \frac{\frac{-\left(\color{blue}{\left(-\alpha\right)} - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            5. Applied rewrites77.8%

              \[\leadsto \frac{\frac{\color{blue}{-\left(\left(-\alpha\right) - 1\right)}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            6. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
              2. lift-/.f64N/A

                \[\leadsto \frac{\color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
              3. associate-/l/N/A

                \[\leadsto \color{blue}{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
            7. Applied rewrites77.8%

              \[\leadsto \color{blue}{\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{\left(\alpha + \beta\right) + 3}}{\left(2 + \alpha\right) + \beta}} \]
            8. Taylor expanded in beta around inf

              \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
            9. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
              2. lower-+.f6476.7

                \[\leadsto \frac{\frac{\color{blue}{1 + \alpha}}{\beta}}{\left(2 + \alpha\right) + \beta} \]
            10. Applied rewrites76.7%

              \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{\beta}}}{\left(2 + \alpha\right) + \beta} \]
          13. Recombined 2 regimes into one program.
          14. Add Preprocessing

          Alternative 9: 93.5% accurate, 2.4× speedup?

          \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 4.8:\\ \;\;\;\;\frac{0.5}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}\\ \mathbf{elif}\;\beta \leq 4.9 \cdot 10^{+161}:\\ \;\;\;\;\frac{\frac{1}{\beta}}{\beta}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\ \end{array} \end{array} \]
          NOTE: alpha and beta should be sorted in increasing order before calling this function.
          (FPCore (alpha beta)
           :precision binary64
           (if (<= beta 4.8)
             (/ 0.5 (* (+ 3.0 alpha) (+ 2.0 alpha)))
             (if (<= beta 4.9e+161) (/ (/ 1.0 beta) beta) (/ (/ alpha beta) beta))))
          assert(alpha < beta);
          double code(double alpha, double beta) {
          	double tmp;
          	if (beta <= 4.8) {
          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha));
          	} else if (beta <= 4.9e+161) {
          		tmp = (1.0 / beta) / beta;
          	} else {
          		tmp = (alpha / beta) / beta;
          	}
          	return tmp;
          }
          
          NOTE: alpha and beta should be sorted in increasing order before calling this function.
          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(alpha, beta)
          use fmin_fmax_functions
              real(8), intent (in) :: alpha
              real(8), intent (in) :: beta
              real(8) :: tmp
              if (beta <= 4.8d0) then
                  tmp = 0.5d0 / ((3.0d0 + alpha) * (2.0d0 + alpha))
              else if (beta <= 4.9d+161) then
                  tmp = (1.0d0 / beta) / beta
              else
                  tmp = (alpha / beta) / beta
              end if
              code = tmp
          end function
          
          assert alpha < beta;
          public static double code(double alpha, double beta) {
          	double tmp;
          	if (beta <= 4.8) {
          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha));
          	} else if (beta <= 4.9e+161) {
          		tmp = (1.0 / beta) / beta;
          	} else {
          		tmp = (alpha / beta) / beta;
          	}
          	return tmp;
          }
          
          [alpha, beta] = sort([alpha, beta])
          def code(alpha, beta):
          	tmp = 0
          	if beta <= 4.8:
          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha))
          	elif beta <= 4.9e+161:
          		tmp = (1.0 / beta) / beta
          	else:
          		tmp = (alpha / beta) / beta
          	return tmp
          
          alpha, beta = sort([alpha, beta])
          function code(alpha, beta)
          	tmp = 0.0
          	if (beta <= 4.8)
          		tmp = Float64(0.5 / Float64(Float64(3.0 + alpha) * Float64(2.0 + alpha)));
          	elseif (beta <= 4.9e+161)
          		tmp = Float64(Float64(1.0 / beta) / beta);
          	else
          		tmp = Float64(Float64(alpha / beta) / beta);
          	end
          	return tmp
          end
          
          alpha, beta = num2cell(sort([alpha, beta])){:}
          function tmp_2 = code(alpha, beta)
          	tmp = 0.0;
          	if (beta <= 4.8)
          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha));
          	elseif (beta <= 4.9e+161)
          		tmp = (1.0 / beta) / beta;
          	else
          		tmp = (alpha / beta) / beta;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: alpha and beta should be sorted in increasing order before calling this function.
          code[alpha_, beta_] := If[LessEqual[beta, 4.8], N[(0.5 / N[(N[(3.0 + alpha), $MachinePrecision] * N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 4.9e+161], N[(N[(1.0 / beta), $MachinePrecision] / beta), $MachinePrecision], N[(N[(alpha / beta), $MachinePrecision] / beta), $MachinePrecision]]]
          
          \begin{array}{l}
          [alpha, beta] = \mathsf{sort}([alpha, beta])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;\beta \leq 4.8:\\
          \;\;\;\;\frac{0.5}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}\\
          
          \mathbf{elif}\;\beta \leq 4.9 \cdot 10^{+161}:\\
          \;\;\;\;\frac{\frac{1}{\beta}}{\beta}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if beta < 4.79999999999999982

            1. Initial program 99.9%

              \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
              2. lift-/.f64N/A

                \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
              3. associate-/l/N/A

                \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
              4. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
            4. Applied rewrites99.3%

              \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]
            5. Taylor expanded in beta around 0

              \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
            6. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
              2. lower-+.f64N/A

                \[\leadsto \frac{\frac{\color{blue}{1 + \alpha}}{2 + \alpha}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
              3. lower-+.f6497.0

                \[\leadsto \frac{\frac{1 + \alpha}{\color{blue}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
            7. Applied rewrites97.0%

              \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
            8. Taylor expanded in alpha around 0

              \[\leadsto \frac{\frac{1}{2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
            9. Step-by-step derivation
              1. Applied rewrites84.8%

                \[\leadsto \frac{0.5}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
              2. Taylor expanded in beta around 0

                \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(2 + \alpha\right) \cdot \left(3 + \alpha\right)}} \]
              3. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}} \]
                2. lower-*.f64N/A

                  \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}} \]
                3. lower-+.f64N/A

                  \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(3 + \alpha\right)} \cdot \left(2 + \alpha\right)} \]
                4. lower-+.f6484.8

                  \[\leadsto \frac{0.5}{\left(3 + \alpha\right) \cdot \color{blue}{\left(2 + \alpha\right)}} \]
              4. Applied rewrites84.8%

                \[\leadsto \frac{0.5}{\color{blue}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}} \]

              if 4.79999999999999982 < beta < 4.89999999999999974e161

              1. Initial program 75.7%

                \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
              2. Add Preprocessing
              3. Taylor expanded in beta around inf

                \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                2. lower-+.f64N/A

                  \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                3. unpow2N/A

                  \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                4. lower-*.f6461.0

                  \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
              5. Applied rewrites61.0%

                \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
              6. Taylor expanded in alpha around inf

                \[\leadsto \frac{\alpha \cdot \left(1 + \frac{1}{\alpha}\right)}{\color{blue}{\beta} \cdot \beta} \]
              7. Step-by-step derivation
                1. Applied rewrites61.0%

                  \[\leadsto \frac{\left(\frac{1}{\alpha} + 1\right) \cdot \alpha}{\color{blue}{\beta} \cdot \beta} \]
                2. Taylor expanded in alpha around 0

                  \[\leadsto \frac{1}{\beta \cdot \beta} \]
                3. Step-by-step derivation
                  1. Applied rewrites61.9%

                    \[\leadsto \frac{1}{\beta \cdot \beta} \]
                  2. Step-by-step derivation
                    1. Applied rewrites64.4%

                      \[\leadsto \frac{\frac{1}{\beta}}{\color{blue}{\beta}} \]

                    if 4.89999999999999974e161 < beta

                    1. Initial program 79.8%

                      \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                    2. Add Preprocessing
                    3. Taylor expanded in beta around inf

                      \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                    4. Step-by-step derivation
                      1. lower-/.f64N/A

                        \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                      2. lower-+.f64N/A

                        \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                      3. unpow2N/A

                        \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                      4. lower-*.f6488.7

                        \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                    5. Applied rewrites88.7%

                      \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                    6. Taylor expanded in alpha around inf

                      \[\leadsto \frac{\alpha}{\color{blue}{{\beta}^{2}}} \]
                    7. Step-by-step derivation
                      1. Applied rewrites88.7%

                        \[\leadsto \frac{\alpha}{\color{blue}{\beta \cdot \beta}} \]
                      2. Step-by-step derivation
                        1. Applied rewrites92.2%

                          \[\leadsto \frac{\frac{\alpha}{\beta}}{\beta} \]
                      3. Recombined 3 regimes into one program.
                      4. Add Preprocessing

                      Alternative 10: 97.2% accurate, 2.4× speedup?

                      \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 6.4:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.25, \beta, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\ \end{array} \end{array} \]
                      NOTE: alpha and beta should be sorted in increasing order before calling this function.
                      (FPCore (alpha beta)
                       :precision binary64
                       (if (<= beta 6.4)
                         (/ (fma 0.25 beta 0.5) (* (+ 3.0 beta) (+ 2.0 beta)))
                         (/ (/ (+ 1.0 alpha) beta) beta)))
                      assert(alpha < beta);
                      double code(double alpha, double beta) {
                      	double tmp;
                      	if (beta <= 6.4) {
                      		tmp = fma(0.25, beta, 0.5) / ((3.0 + beta) * (2.0 + beta));
                      	} else {
                      		tmp = ((1.0 + alpha) / beta) / beta;
                      	}
                      	return tmp;
                      }
                      
                      alpha, beta = sort([alpha, beta])
                      function code(alpha, beta)
                      	tmp = 0.0
                      	if (beta <= 6.4)
                      		tmp = Float64(fma(0.25, beta, 0.5) / Float64(Float64(3.0 + beta) * Float64(2.0 + beta)));
                      	else
                      		tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta);
                      	end
                      	return tmp
                      end
                      
                      NOTE: alpha and beta should be sorted in increasing order before calling this function.
                      code[alpha_, beta_] := If[LessEqual[beta, 6.4], N[(N[(0.25 * beta + 0.5), $MachinePrecision] / N[(N[(3.0 + beta), $MachinePrecision] * N[(2.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / beta), $MachinePrecision]]
                      
                      \begin{array}{l}
                      [alpha, beta] = \mathsf{sort}([alpha, beta])\\
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;\beta \leq 6.4:\\
                      \;\;\;\;\frac{\mathsf{fma}\left(0.25, \beta, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if beta < 6.4000000000000004

                        1. Initial program 99.9%

                          \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. lift-/.f64N/A

                            \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
                          2. lift-/.f64N/A

                            \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                          3. associate-/l/N/A

                            \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
                          4. lower-/.f64N/A

                            \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
                        4. Applied rewrites99.3%

                          \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]
                        5. Taylor expanded in alpha around 0

                          \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                        6. Step-by-step derivation
                          1. lower-/.f64N/A

                            \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                          2. lower-+.f64N/A

                            \[\leadsto \frac{\frac{\color{blue}{1 + \beta}}{2 + \beta}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                          3. lower-+.f6486.8

                            \[\leadsto \frac{\frac{1 + \beta}{\color{blue}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                        7. Applied rewrites86.8%

                          \[\leadsto \frac{\color{blue}{\frac{1 + \beta}{2 + \beta}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                        8. Taylor expanded in alpha around 0

                          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(2 + \beta\right) \cdot \left(3 + \beta\right)}} \]
                        9. Step-by-step derivation
                          1. *-commutativeN/A

                            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
                          2. lower-*.f64N/A

                            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
                          3. lower-+.f64N/A

                            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right)} \cdot \left(2 + \beta\right)} \]
                          4. lower-+.f6468.9

                            \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\left(3 + \beta\right) \cdot \color{blue}{\left(2 + \beta\right)}} \]
                        10. Applied rewrites68.9%

                          \[\leadsto \frac{\frac{1 + \beta}{2 + \beta}}{\color{blue}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)}} \]
                        11. Taylor expanded in beta around 0

                          \[\leadsto \frac{\frac{1}{2} + \color{blue}{\frac{1}{4} \cdot \beta}}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)} \]
                        12. Step-by-step derivation
                          1. Applied rewrites67.9%

                            \[\leadsto \frac{\mathsf{fma}\left(0.25, \color{blue}{\beta}, 0.5\right)}{\left(3 + \beta\right) \cdot \left(2 + \beta\right)} \]

                          if 6.4000000000000004 < beta

                          1. Initial program 77.7%

                            \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                          2. Add Preprocessing
                          3. Taylor expanded in beta around inf

                            \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                          4. Step-by-step derivation
                            1. lower-/.f64N/A

                              \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                            2. lower-+.f64N/A

                              \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                            3. unpow2N/A

                              \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                            4. lower-*.f6474.5

                              \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                          5. Applied rewrites74.5%

                            \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                          6. Step-by-step derivation
                            1. Applied rewrites76.4%

                              \[\leadsto \color{blue}{\frac{\frac{1 + \alpha}{\beta}}{\beta}} \]
                          7. Recombined 2 regimes into one program.
                          8. Add Preprocessing

                          Alternative 11: 96.7% accurate, 2.6× speedup?

                          \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 4.8:\\ \;\;\;\;\frac{0.5}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\ \end{array} \end{array} \]
                          NOTE: alpha and beta should be sorted in increasing order before calling this function.
                          (FPCore (alpha beta)
                           :precision binary64
                           (if (<= beta 4.8)
                             (/ 0.5 (* (+ 3.0 alpha) (+ 2.0 alpha)))
                             (/ (/ (+ 1.0 alpha) beta) beta)))
                          assert(alpha < beta);
                          double code(double alpha, double beta) {
                          	double tmp;
                          	if (beta <= 4.8) {
                          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha));
                          	} else {
                          		tmp = ((1.0 + alpha) / beta) / beta;
                          	}
                          	return tmp;
                          }
                          
                          NOTE: alpha and beta should be sorted in increasing order before calling this function.
                          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(alpha, beta)
                          use fmin_fmax_functions
                              real(8), intent (in) :: alpha
                              real(8), intent (in) :: beta
                              real(8) :: tmp
                              if (beta <= 4.8d0) then
                                  tmp = 0.5d0 / ((3.0d0 + alpha) * (2.0d0 + alpha))
                              else
                                  tmp = ((1.0d0 + alpha) / beta) / beta
                              end if
                              code = tmp
                          end function
                          
                          assert alpha < beta;
                          public static double code(double alpha, double beta) {
                          	double tmp;
                          	if (beta <= 4.8) {
                          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha));
                          	} else {
                          		tmp = ((1.0 + alpha) / beta) / beta;
                          	}
                          	return tmp;
                          }
                          
                          [alpha, beta] = sort([alpha, beta])
                          def code(alpha, beta):
                          	tmp = 0
                          	if beta <= 4.8:
                          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha))
                          	else:
                          		tmp = ((1.0 + alpha) / beta) / beta
                          	return tmp
                          
                          alpha, beta = sort([alpha, beta])
                          function code(alpha, beta)
                          	tmp = 0.0
                          	if (beta <= 4.8)
                          		tmp = Float64(0.5 / Float64(Float64(3.0 + alpha) * Float64(2.0 + alpha)));
                          	else
                          		tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / beta);
                          	end
                          	return tmp
                          end
                          
                          alpha, beta = num2cell(sort([alpha, beta])){:}
                          function tmp_2 = code(alpha, beta)
                          	tmp = 0.0;
                          	if (beta <= 4.8)
                          		tmp = 0.5 / ((3.0 + alpha) * (2.0 + alpha));
                          	else
                          		tmp = ((1.0 + alpha) / beta) / beta;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          NOTE: alpha and beta should be sorted in increasing order before calling this function.
                          code[alpha_, beta_] := If[LessEqual[beta, 4.8], N[(0.5 / N[(N[(3.0 + alpha), $MachinePrecision] * N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / beta), $MachinePrecision]]
                          
                          \begin{array}{l}
                          [alpha, beta] = \mathsf{sort}([alpha, beta])\\
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;\beta \leq 4.8:\\
                          \;\;\;\;\frac{0.5}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{\beta}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if beta < 4.79999999999999982

                            1. Initial program 99.9%

                              \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                            2. Add Preprocessing
                            3. Step-by-step derivation
                              1. lift-/.f64N/A

                                \[\leadsto \color{blue}{\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}} \]
                              2. lift-/.f64N/A

                                \[\leadsto \frac{\color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                              3. associate-/l/N/A

                                \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
                              4. lower-/.f64N/A

                                \[\leadsto \color{blue}{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) \cdot \left(\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1\right)}} \]
                            4. Applied rewrites99.3%

                              \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) + 1}{\left(\beta + \alpha\right) + 2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)}} \]
                            5. Taylor expanded in beta around 0

                              \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                            6. Step-by-step derivation
                              1. lower-/.f64N/A

                                \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                              2. lower-+.f64N/A

                                \[\leadsto \frac{\frac{\color{blue}{1 + \alpha}}{2 + \alpha}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                              3. lower-+.f6497.0

                                \[\leadsto \frac{\frac{1 + \alpha}{\color{blue}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                            7. Applied rewrites97.0%

                              \[\leadsto \frac{\color{blue}{\frac{1 + \alpha}{2 + \alpha}}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                            8. Taylor expanded in alpha around 0

                              \[\leadsto \frac{\frac{1}{2}}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                            9. Step-by-step derivation
                              1. Applied rewrites84.8%

                                \[\leadsto \frac{0.5}{\left(3 + \left(\beta + \alpha\right)\right) \cdot \left(\left(\beta + \alpha\right) + 2\right)} \]
                              2. Taylor expanded in beta around 0

                                \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(2 + \alpha\right) \cdot \left(3 + \alpha\right)}} \]
                              3. Step-by-step derivation
                                1. *-commutativeN/A

                                  \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}} \]
                                2. lower-*.f64N/A

                                  \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}} \]
                                3. lower-+.f64N/A

                                  \[\leadsto \frac{\frac{1}{2}}{\color{blue}{\left(3 + \alpha\right)} \cdot \left(2 + \alpha\right)} \]
                                4. lower-+.f6484.8

                                  \[\leadsto \frac{0.5}{\left(3 + \alpha\right) \cdot \color{blue}{\left(2 + \alpha\right)}} \]
                              4. Applied rewrites84.8%

                                \[\leadsto \frac{0.5}{\color{blue}{\left(3 + \alpha\right) \cdot \left(2 + \alpha\right)}} \]

                              if 4.79999999999999982 < beta

                              1. Initial program 77.7%

                                \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                              2. Add Preprocessing
                              3. Taylor expanded in beta around inf

                                \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                              4. Step-by-step derivation
                                1. lower-/.f64N/A

                                  \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                2. lower-+.f64N/A

                                  \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                3. unpow2N/A

                                  \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                4. lower-*.f6474.5

                                  \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                              5. Applied rewrites74.5%

                                \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                              6. Step-by-step derivation
                                1. Applied rewrites76.4%

                                  \[\leadsto \color{blue}{\frac{\frac{1 + \alpha}{\beta}}{\beta}} \]
                              7. Recombined 2 regimes into one program.
                              8. Add Preprocessing

                              Alternative 12: 54.4% accurate, 2.9× speedup?

                              \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\alpha \leq 0.012:\\ \;\;\;\;\frac{\frac{1}{\beta}}{\beta}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\ \end{array} \end{array} \]
                              NOTE: alpha and beta should be sorted in increasing order before calling this function.
                              (FPCore (alpha beta)
                               :precision binary64
                               (if (<= alpha 0.012) (/ (/ 1.0 beta) beta) (/ (/ alpha beta) beta)))
                              assert(alpha < beta);
                              double code(double alpha, double beta) {
                              	double tmp;
                              	if (alpha <= 0.012) {
                              		tmp = (1.0 / beta) / beta;
                              	} else {
                              		tmp = (alpha / beta) / beta;
                              	}
                              	return tmp;
                              }
                              
                              NOTE: alpha and beta should be sorted in increasing order before calling this function.
                              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(alpha, beta)
                              use fmin_fmax_functions
                                  real(8), intent (in) :: alpha
                                  real(8), intent (in) :: beta
                                  real(8) :: tmp
                                  if (alpha <= 0.012d0) then
                                      tmp = (1.0d0 / beta) / beta
                                  else
                                      tmp = (alpha / beta) / beta
                                  end if
                                  code = tmp
                              end function
                              
                              assert alpha < beta;
                              public static double code(double alpha, double beta) {
                              	double tmp;
                              	if (alpha <= 0.012) {
                              		tmp = (1.0 / beta) / beta;
                              	} else {
                              		tmp = (alpha / beta) / beta;
                              	}
                              	return tmp;
                              }
                              
                              [alpha, beta] = sort([alpha, beta])
                              def code(alpha, beta):
                              	tmp = 0
                              	if alpha <= 0.012:
                              		tmp = (1.0 / beta) / beta
                              	else:
                              		tmp = (alpha / beta) / beta
                              	return tmp
                              
                              alpha, beta = sort([alpha, beta])
                              function code(alpha, beta)
                              	tmp = 0.0
                              	if (alpha <= 0.012)
                              		tmp = Float64(Float64(1.0 / beta) / beta);
                              	else
                              		tmp = Float64(Float64(alpha / beta) / beta);
                              	end
                              	return tmp
                              end
                              
                              alpha, beta = num2cell(sort([alpha, beta])){:}
                              function tmp_2 = code(alpha, beta)
                              	tmp = 0.0;
                              	if (alpha <= 0.012)
                              		tmp = (1.0 / beta) / beta;
                              	else
                              		tmp = (alpha / beta) / beta;
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              NOTE: alpha and beta should be sorted in increasing order before calling this function.
                              code[alpha_, beta_] := If[LessEqual[alpha, 0.012], N[(N[(1.0 / beta), $MachinePrecision] / beta), $MachinePrecision], N[(N[(alpha / beta), $MachinePrecision] / beta), $MachinePrecision]]
                              
                              \begin{array}{l}
                              [alpha, beta] = \mathsf{sort}([alpha, beta])\\
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;\alpha \leq 0.012:\\
                              \;\;\;\;\frac{\frac{1}{\beta}}{\beta}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if alpha < 0.012

                                1. Initial program 99.8%

                                  \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                                2. Add Preprocessing
                                3. Taylor expanded in beta around inf

                                  \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                4. Step-by-step derivation
                                  1. lower-/.f64N/A

                                    \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                  2. lower-+.f64N/A

                                    \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                  3. unpow2N/A

                                    \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                  4. lower-*.f6432.2

                                    \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                5. Applied rewrites32.2%

                                  \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                                6. Taylor expanded in alpha around inf

                                  \[\leadsto \frac{\alpha \cdot \left(1 + \frac{1}{\alpha}\right)}{\color{blue}{\beta} \cdot \beta} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites32.2%

                                    \[\leadsto \frac{\left(\frac{1}{\alpha} + 1\right) \cdot \alpha}{\color{blue}{\beta} \cdot \beta} \]
                                  2. Taylor expanded in alpha around 0

                                    \[\leadsto \frac{1}{\beta \cdot \beta} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites32.2%

                                      \[\leadsto \frac{1}{\beta \cdot \beta} \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites32.9%

                                        \[\leadsto \frac{\frac{1}{\beta}}{\color{blue}{\beta}} \]

                                      if 0.012 < alpha

                                      1. Initial program 79.3%

                                        \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in beta around inf

                                        \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                      4. Step-by-step derivation
                                        1. lower-/.f64N/A

                                          \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                        2. lower-+.f64N/A

                                          \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                        3. unpow2N/A

                                          \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                        4. lower-*.f6413.0

                                          \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                      5. Applied rewrites13.0%

                                        \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                                      6. Taylor expanded in alpha around inf

                                        \[\leadsto \frac{\alpha}{\color{blue}{{\beta}^{2}}} \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites13.0%

                                          \[\leadsto \frac{\alpha}{\color{blue}{\beta \cdot \beta}} \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites13.4%

                                            \[\leadsto \frac{\frac{\alpha}{\beta}}{\beta} \]
                                        3. Recombined 2 regimes into one program.
                                        4. Add Preprocessing

                                        Alternative 13: 54.8% accurate, 2.9× speedup?

                                        \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \begin{array}{l} \mathbf{if}\;\beta \leq 5 \cdot 10^{+153}:\\ \;\;\;\;\frac{1 + \alpha}{\beta \cdot \beta}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\ \end{array} \end{array} \]
                                        NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                        (FPCore (alpha beta)
                                         :precision binary64
                                         (if (<= beta 5e+153) (/ (+ 1.0 alpha) (* beta beta)) (/ (/ alpha beta) beta)))
                                        assert(alpha < beta);
                                        double code(double alpha, double beta) {
                                        	double tmp;
                                        	if (beta <= 5e+153) {
                                        		tmp = (1.0 + alpha) / (beta * beta);
                                        	} else {
                                        		tmp = (alpha / beta) / beta;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                        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(alpha, beta)
                                        use fmin_fmax_functions
                                            real(8), intent (in) :: alpha
                                            real(8), intent (in) :: beta
                                            real(8) :: tmp
                                            if (beta <= 5d+153) then
                                                tmp = (1.0d0 + alpha) / (beta * beta)
                                            else
                                                tmp = (alpha / beta) / beta
                                            end if
                                            code = tmp
                                        end function
                                        
                                        assert alpha < beta;
                                        public static double code(double alpha, double beta) {
                                        	double tmp;
                                        	if (beta <= 5e+153) {
                                        		tmp = (1.0 + alpha) / (beta * beta);
                                        	} else {
                                        		tmp = (alpha / beta) / beta;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        [alpha, beta] = sort([alpha, beta])
                                        def code(alpha, beta):
                                        	tmp = 0
                                        	if beta <= 5e+153:
                                        		tmp = (1.0 + alpha) / (beta * beta)
                                        	else:
                                        		tmp = (alpha / beta) / beta
                                        	return tmp
                                        
                                        alpha, beta = sort([alpha, beta])
                                        function code(alpha, beta)
                                        	tmp = 0.0
                                        	if (beta <= 5e+153)
                                        		tmp = Float64(Float64(1.0 + alpha) / Float64(beta * beta));
                                        	else
                                        		tmp = Float64(Float64(alpha / beta) / beta);
                                        	end
                                        	return tmp
                                        end
                                        
                                        alpha, beta = num2cell(sort([alpha, beta])){:}
                                        function tmp_2 = code(alpha, beta)
                                        	tmp = 0.0;
                                        	if (beta <= 5e+153)
                                        		tmp = (1.0 + alpha) / (beta * beta);
                                        	else
                                        		tmp = (alpha / beta) / beta;
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                        code[alpha_, beta_] := If[LessEqual[beta, 5e+153], N[(N[(1.0 + alpha), $MachinePrecision] / N[(beta * beta), $MachinePrecision]), $MachinePrecision], N[(N[(alpha / beta), $MachinePrecision] / beta), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        [alpha, beta] = \mathsf{sort}([alpha, beta])\\
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;\beta \leq 5 \cdot 10^{+153}:\\
                                        \;\;\;\;\frac{1 + \alpha}{\beta \cdot \beta}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if beta < 5.00000000000000018e153

                                          1. Initial program 96.1%

                                            \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in beta around inf

                                            \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                          4. Step-by-step derivation
                                            1. lower-/.f64N/A

                                              \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                            2. lower-+.f64N/A

                                              \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                            3. unpow2N/A

                                              \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                            4. lower-*.f6413.4

                                              \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                          5. Applied rewrites13.4%

                                            \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]

                                          if 5.00000000000000018e153 < beta

                                          1. Initial program 77.7%

                                            \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in beta around inf

                                            \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                          4. Step-by-step derivation
                                            1. lower-/.f64N/A

                                              \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                            2. lower-+.f64N/A

                                              \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                            3. unpow2N/A

                                              \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                            4. lower-*.f6485.2

                                              \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                          5. Applied rewrites85.2%

                                            \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                                          6. Taylor expanded in alpha around inf

                                            \[\leadsto \frac{\alpha}{\color{blue}{{\beta}^{2}}} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites85.2%

                                              \[\leadsto \frac{\alpha}{\color{blue}{\beta \cdot \beta}} \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites86.0%

                                                \[\leadsto \frac{\frac{\alpha}{\beta}}{\beta} \]
                                            3. Recombined 2 regimes into one program.
                                            4. Add Preprocessing

                                            Alternative 14: 52.3% accurate, 4.2× speedup?

                                            \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \frac{1 + \alpha}{\beta \cdot \beta} \end{array} \]
                                            NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                            (FPCore (alpha beta) :precision binary64 (/ (+ 1.0 alpha) (* beta beta)))
                                            assert(alpha < beta);
                                            double code(double alpha, double beta) {
                                            	return (1.0 + alpha) / (beta * beta);
                                            }
                                            
                                            NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                            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(alpha, beta)
                                            use fmin_fmax_functions
                                                real(8), intent (in) :: alpha
                                                real(8), intent (in) :: beta
                                                code = (1.0d0 + alpha) / (beta * beta)
                                            end function
                                            
                                            assert alpha < beta;
                                            public static double code(double alpha, double beta) {
                                            	return (1.0 + alpha) / (beta * beta);
                                            }
                                            
                                            [alpha, beta] = sort([alpha, beta])
                                            def code(alpha, beta):
                                            	return (1.0 + alpha) / (beta * beta)
                                            
                                            alpha, beta = sort([alpha, beta])
                                            function code(alpha, beta)
                                            	return Float64(Float64(1.0 + alpha) / Float64(beta * beta))
                                            end
                                            
                                            alpha, beta = num2cell(sort([alpha, beta])){:}
                                            function tmp = code(alpha, beta)
                                            	tmp = (1.0 + alpha) / (beta * beta);
                                            end
                                            
                                            NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                            code[alpha_, beta_] := N[(N[(1.0 + alpha), $MachinePrecision] / N[(beta * beta), $MachinePrecision]), $MachinePrecision]
                                            
                                            \begin{array}{l}
                                            [alpha, beta] = \mathsf{sort}([alpha, beta])\\
                                            \\
                                            \frac{1 + \alpha}{\beta \cdot \beta}
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 92.9%

                                              \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in beta around inf

                                              \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                            4. Step-by-step derivation
                                              1. lower-/.f64N/A

                                                \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                              2. lower-+.f64N/A

                                                \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                              3. unpow2N/A

                                                \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                              4. lower-*.f6425.7

                                                \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                            5. Applied rewrites25.7%

                                              \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                                            6. Add Preprocessing

                                            Alternative 15: 49.4% accurate, 4.9× speedup?

                                            \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \frac{1}{\beta \cdot \beta} \end{array} \]
                                            NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                            (FPCore (alpha beta) :precision binary64 (/ 1.0 (* beta beta)))
                                            assert(alpha < beta);
                                            double code(double alpha, double beta) {
                                            	return 1.0 / (beta * beta);
                                            }
                                            
                                            NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                            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(alpha, beta)
                                            use fmin_fmax_functions
                                                real(8), intent (in) :: alpha
                                                real(8), intent (in) :: beta
                                                code = 1.0d0 / (beta * beta)
                                            end function
                                            
                                            assert alpha < beta;
                                            public static double code(double alpha, double beta) {
                                            	return 1.0 / (beta * beta);
                                            }
                                            
                                            [alpha, beta] = sort([alpha, beta])
                                            def code(alpha, beta):
                                            	return 1.0 / (beta * beta)
                                            
                                            alpha, beta = sort([alpha, beta])
                                            function code(alpha, beta)
                                            	return Float64(1.0 / Float64(beta * beta))
                                            end
                                            
                                            alpha, beta = num2cell(sort([alpha, beta])){:}
                                            function tmp = code(alpha, beta)
                                            	tmp = 1.0 / (beta * beta);
                                            end
                                            
                                            NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                            code[alpha_, beta_] := N[(1.0 / N[(beta * beta), $MachinePrecision]), $MachinePrecision]
                                            
                                            \begin{array}{l}
                                            [alpha, beta] = \mathsf{sort}([alpha, beta])\\
                                            \\
                                            \frac{1}{\beta \cdot \beta}
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 92.9%

                                              \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in beta around inf

                                              \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                            4. Step-by-step derivation
                                              1. lower-/.f64N/A

                                                \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                              2. lower-+.f64N/A

                                                \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                              3. unpow2N/A

                                                \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                              4. lower-*.f6425.7

                                                \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                            5. Applied rewrites25.7%

                                              \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                                            6. Taylor expanded in alpha around 0

                                              \[\leadsto \frac{1}{\color{blue}{\beta} \cdot \beta} \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites25.9%

                                                \[\leadsto \frac{1}{\color{blue}{\beta} \cdot \beta} \]
                                              2. Add Preprocessing

                                              Alternative 16: 31.8% accurate, 4.9× speedup?

                                              \[\begin{array}{l} [alpha, beta] = \mathsf{sort}([alpha, beta])\\ \\ \frac{\alpha}{\beta \cdot \beta} \end{array} \]
                                              NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                              (FPCore (alpha beta) :precision binary64 (/ alpha (* beta beta)))
                                              assert(alpha < beta);
                                              double code(double alpha, double beta) {
                                              	return alpha / (beta * beta);
                                              }
                                              
                                              NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                              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(alpha, beta)
                                              use fmin_fmax_functions
                                                  real(8), intent (in) :: alpha
                                                  real(8), intent (in) :: beta
                                                  code = alpha / (beta * beta)
                                              end function
                                              
                                              assert alpha < beta;
                                              public static double code(double alpha, double beta) {
                                              	return alpha / (beta * beta);
                                              }
                                              
                                              [alpha, beta] = sort([alpha, beta])
                                              def code(alpha, beta):
                                              	return alpha / (beta * beta)
                                              
                                              alpha, beta = sort([alpha, beta])
                                              function code(alpha, beta)
                                              	return Float64(alpha / Float64(beta * beta))
                                              end
                                              
                                              alpha, beta = num2cell(sort([alpha, beta])){:}
                                              function tmp = code(alpha, beta)
                                              	tmp = alpha / (beta * beta);
                                              end
                                              
                                              NOTE: alpha and beta should be sorted in increasing order before calling this function.
                                              code[alpha_, beta_] := N[(alpha / N[(beta * beta), $MachinePrecision]), $MachinePrecision]
                                              
                                              \begin{array}{l}
                                              [alpha, beta] = \mathsf{sort}([alpha, beta])\\
                                              \\
                                              \frac{\alpha}{\beta \cdot \beta}
                                              \end{array}
                                              
                                              Derivation
                                              1. Initial program 92.9%

                                                \[\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\alpha + \beta\right) + 2 \cdot 1}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1} \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in beta around inf

                                                \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                              4. Step-by-step derivation
                                                1. lower-/.f64N/A

                                                  \[\leadsto \color{blue}{\frac{1 + \alpha}{{\beta}^{2}}} \]
                                                2. lower-+.f64N/A

                                                  \[\leadsto \frac{\color{blue}{1 + \alpha}}{{\beta}^{2}} \]
                                                3. unpow2N/A

                                                  \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                                4. lower-*.f6425.7

                                                  \[\leadsto \frac{1 + \alpha}{\color{blue}{\beta \cdot \beta}} \]
                                              5. Applied rewrites25.7%

                                                \[\leadsto \color{blue}{\frac{1 + \alpha}{\beta \cdot \beta}} \]
                                              6. Taylor expanded in alpha around inf

                                                \[\leadsto \frac{\alpha}{\color{blue}{{\beta}^{2}}} \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites17.1%

                                                  \[\leadsto \frac{\alpha}{\color{blue}{\beta \cdot \beta}} \]
                                                2. Add Preprocessing

                                                Reproduce

                                                ?
                                                herbie shell --seed 2024359 
                                                (FPCore (alpha beta)
                                                  :name "Octave 3.8, jcobi/3"
                                                  :precision binary64
                                                  :pre (and (> alpha -1.0) (> beta -1.0))
                                                  (/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) (+ (+ alpha beta) (* 2.0 1.0))) (+ (+ alpha beta) (* 2.0 1.0))) (+ (+ (+ alpha beta) (* 2.0 1.0)) 1.0)))