Falkner and Boettcher, Appendix A

Percentage Accurate: 90.6% → 97.7%
Time: 4.5s
Alternatives: 14
Speedup: 1.3×

Specification

?
\[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
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(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
	return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m):
	return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function tmp = code(a, k, m)
	tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}

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 14 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: 90.6% accurate, 1.0× speedup?

\[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
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(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
	return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m):
	return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function tmp = code(a, k, m)
	tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}

Alternative 1: 97.7% accurate, 0.5× speedup?

\[\begin{array}{l} t_0 := a \cdot {k}^{m}\\ t_1 := \frac{t\_0}{\left(1 + 10 \cdot k\right) + k \cdot k}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+293}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* 10.0 k)) (* k k)))))
   (if (<= t_1 5e+293) t_1 t_0)))
double code(double a, double k, double m) {
	double t_0 = a * pow(k, m);
	double t_1 = t_0 / ((1.0 + (10.0 * k)) + (k * k));
	double tmp;
	if (t_1 <= 5e+293) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = a * (k ** m)
    t_1 = t_0 / ((1.0d0 + (10.0d0 * k)) + (k * k))
    if (t_1 <= 5d+293) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double t_0 = a * Math.pow(k, m);
	double t_1 = t_0 / ((1.0 + (10.0 * k)) + (k * k));
	double tmp;
	if (t_1 <= 5e+293) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, k, m):
	t_0 = a * math.pow(k, m)
	t_1 = t_0 / ((1.0 + (10.0 * k)) + (k * k))
	tmp = 0
	if t_1 <= 5e+293:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(a, k, m)
	t_0 = Float64(a * (k ^ m))
	t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
	tmp = 0.0
	if (t_1 <= 5e+293)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	t_0 = a * (k ^ m);
	t_1 = t_0 / ((1.0 + (10.0 * k)) + (k * k));
	tmp = 0.0;
	if (t_1 <= 5e+293)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+293], t$95$1, t$95$0]]]
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t\_0}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+293}:\\
\;\;\;\;t\_1\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 5.0000000000000003e293

    1. Initial program 90.6%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]

    if 5.0000000000000003e293 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k)))

    1. Initial program 90.6%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
    3. Applied rewrites90.7%

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a} \]
    4. Taylor expanded in k around 0

      \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
    5. Step-by-step derivation
      1. Applied rewrites80.3%

        \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
      2. Taylor expanded in k around 0

        \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
      3. Step-by-step derivation
        1. Applied rewrites82.9%

          \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
        2. Taylor expanded in k around 0

          \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
          2. lower-pow.f6482.9%

            \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
        4. Applied rewrites82.9%

          \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
      4. Recombined 2 regimes into one program.
      5. Add Preprocessing

      Alternative 2: 97.7% accurate, 0.5× speedup?

      \[\begin{array}{l} t_0 := a \cdot {k}^{m}\\ \mathbf{if}\;\frac{t\_0}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 5 \cdot 10^{+293}:\\ \;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
      (FPCore (a k m)
       :precision binary64
       (let* ((t_0 (* a (pow k m))))
         (if (<= (/ t_0 (+ (+ 1.0 (* 10.0 k)) (* k k))) 5e+293)
           (* (/ (pow k m) (fma (- k -10.0) k 1.0)) a)
           t_0)))
      double code(double a, double k, double m) {
      	double t_0 = a * pow(k, m);
      	double tmp;
      	if ((t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= 5e+293) {
      		tmp = (pow(k, m) / fma((k - -10.0), k, 1.0)) * a;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(a, k, m)
      	t_0 = Float64(a * (k ^ m))
      	tmp = 0.0
      	if (Float64(t_0 / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 5e+293)
      		tmp = Float64(Float64((k ^ m) / fma(Float64(k - -10.0), k, 1.0)) * a);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+293], N[(N[(N[Power[k, m], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], t$95$0]]
      
      \begin{array}{l}
      t_0 := a \cdot {k}^{m}\\
      \mathbf{if}\;\frac{t\_0}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 5 \cdot 10^{+293}:\\
      \;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 5.0000000000000003e293

        1. Initial program 90.6%

          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
        3. Applied rewrites90.7%

          \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a} \]

        if 5.0000000000000003e293 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k)))

        1. Initial program 90.6%

          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
        3. Applied rewrites90.7%

          \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a} \]
        4. Taylor expanded in k around 0

          \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
        5. Step-by-step derivation
          1. Applied rewrites80.3%

            \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
          2. Taylor expanded in k around 0

            \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
          3. Step-by-step derivation
            1. Applied rewrites82.9%

              \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
            2. Taylor expanded in k around 0

              \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
              2. lower-pow.f6482.9%

                \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
            4. Applied rewrites82.9%

              \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 3: 97.0% accurate, 1.1× speedup?

          \[\begin{array}{l} t_0 := a \cdot {k}^{m}\\ \mathbf{if}\;m \leq 1.4:\\ \;\;\;\;\frac{t\_0}{1 + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
          (FPCore (a k m)
           :precision binary64
           (let* ((t_0 (* a (pow k m)))) (if (<= m 1.4) (/ t_0 (+ 1.0 (* k k))) t_0)))
          double code(double a, double k, double m) {
          	double t_0 = a * pow(k, m);
          	double tmp;
          	if (m <= 1.4) {
          		tmp = t_0 / (1.0 + (k * k));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(a, k, m)
          use fmin_fmax_functions
              real(8), intent (in) :: a
              real(8), intent (in) :: k
              real(8), intent (in) :: m
              real(8) :: t_0
              real(8) :: tmp
              t_0 = a * (k ** m)
              if (m <= 1.4d0) then
                  tmp = t_0 / (1.0d0 + (k * k))
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double a, double k, double m) {
          	double t_0 = a * Math.pow(k, m);
          	double tmp;
          	if (m <= 1.4) {
          		tmp = t_0 / (1.0 + (k * k));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(a, k, m):
          	t_0 = a * math.pow(k, m)
          	tmp = 0
          	if m <= 1.4:
          		tmp = t_0 / (1.0 + (k * k))
          	else:
          		tmp = t_0
          	return tmp
          
          function code(a, k, m)
          	t_0 = Float64(a * (k ^ m))
          	tmp = 0.0
          	if (m <= 1.4)
          		tmp = Float64(t_0 / Float64(1.0 + Float64(k * k)));
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, k, m)
          	t_0 = a * (k ^ m);
          	tmp = 0.0;
          	if (m <= 1.4)
          		tmp = t_0 / (1.0 + (k * k));
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 1.4], N[(t$95$0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
          
          \begin{array}{l}
          t_0 := a \cdot {k}^{m}\\
          \mathbf{if}\;m \leq 1.4:\\
          \;\;\;\;\frac{t\_0}{1 + k \cdot k}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if m < 1.3999999999999999

            1. Initial program 90.6%

              \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
            2. Taylor expanded in k around 0

              \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1} + k \cdot k} \]
            3. Step-by-step derivation
              1. Applied rewrites89.8%

                \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1} + k \cdot k} \]

              if 1.3999999999999999 < m

              1. Initial program 90.6%

                \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
              2. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                2. lift-*.f64N/A

                  \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                3. associate-/l*N/A

                  \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                4. *-commutativeN/A

                  \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                5. lower-*.f64N/A

                  \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
              3. Applied rewrites90.7%

                \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a} \]
              4. Taylor expanded in k around 0

                \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
              5. Step-by-step derivation
                1. Applied rewrites80.3%

                  \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
                2. Taylor expanded in k around 0

                  \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
                3. Step-by-step derivation
                  1. Applied rewrites82.9%

                    \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
                  2. Taylor expanded in k around 0

                    \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
                  3. Step-by-step derivation
                    1. lower-*.f64N/A

                      \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
                    2. lower-pow.f6482.9%

                      \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
                  4. Applied rewrites82.9%

                    \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
                4. Recombined 2 regimes into one program.
                5. Add Preprocessing

                Alternative 4: 96.9% accurate, 1.3× speedup?

                \[\begin{array}{l} t_0 := a \cdot {k}^{m}\\ \mathbf{if}\;m \leq -2.6 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 3.4 \cdot 10^{-9}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                (FPCore (a k m)
                 :precision binary64
                 (let* ((t_0 (* a (pow k m))))
                   (if (<= m -2.6e-8)
                     t_0
                     (if (<= m 3.4e-9) (/ a (fma (- k -10.0) k 1.0)) t_0))))
                double code(double a, double k, double m) {
                	double t_0 = a * pow(k, m);
                	double tmp;
                	if (m <= -2.6e-8) {
                		tmp = t_0;
                	} else if (m <= 3.4e-9) {
                		tmp = a / fma((k - -10.0), k, 1.0);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                function code(a, k, m)
                	t_0 = Float64(a * (k ^ m))
                	tmp = 0.0
                	if (m <= -2.6e-8)
                		tmp = t_0;
                	elseif (m <= 3.4e-9)
                		tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0));
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -2.6e-8], t$95$0, If[LessEqual[m, 3.4e-9], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                t_0 := a \cdot {k}^{m}\\
                \mathbf{if}\;m \leq -2.6 \cdot 10^{-8}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;m \leq 3.4 \cdot 10^{-9}:\\
                \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if m < -2.6000000000000001e-8 or 3.3999999999999998e-9 < m

                  1. Initial program 90.6%

                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                  2. Step-by-step derivation
                    1. lift-/.f64N/A

                      \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                    2. lift-*.f64N/A

                      \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                    3. associate-/l*N/A

                      \[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
                    4. *-commutativeN/A

                      \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                    5. lower-*.f64N/A

                      \[\leadsto \color{blue}{\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot a} \]
                  3. Applied rewrites90.7%

                    \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a} \]
                  4. Taylor expanded in k around 0

                    \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
                  5. Step-by-step derivation
                    1. Applied rewrites80.3%

                      \[\leadsto \frac{{k}^{m}}{\mathsf{fma}\left(\color{blue}{10}, k, 1\right)} \cdot a \]
                    2. Taylor expanded in k around 0

                      \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
                    3. Step-by-step derivation
                      1. Applied rewrites82.9%

                        \[\leadsto \frac{{k}^{m}}{\color{blue}{1}} \cdot a \]
                      2. Taylor expanded in k around 0

                        \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
                      3. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
                        2. lower-pow.f6482.9%

                          \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
                      4. Applied rewrites82.9%

                        \[\leadsto \color{blue}{a \cdot {k}^{m}} \]

                      if -2.6000000000000001e-8 < m < 3.3999999999999998e-9

                      1. Initial program 90.6%

                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                      2. Taylor expanded in m around 0

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

                          \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        2. lower-+.f64N/A

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

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                        4. lower-pow.f6444.3%

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                      4. Applied rewrites44.3%

                        \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                      5. Step-by-step derivation
                        1. lift-fma.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \]
                        2. lift-pow.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + {k}^{\color{blue}{2}}\right)} \]
                        3. pow2N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)} \]
                        4. lift-*.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)} \]
                        5. +-commutativeN/A

                          \[\leadsto \frac{a}{1 + \left(k \cdot k + \color{blue}{10 \cdot k}\right)} \]
                        6. lift-*.f64N/A

                          \[\leadsto \frac{a}{1 + \left(k \cdot k + \color{blue}{10} \cdot k\right)} \]
                        7. distribute-rgt-outN/A

                          \[\leadsto \frac{a}{1 + k \cdot \color{blue}{\left(k + 10\right)}} \]
                        8. metadata-evalN/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k + \left(\mathsf{neg}\left(-10\right)\right)\right)} \]
                        9. sub-flipN/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k - \color{blue}{-10}\right)} \]
                        10. lift--.f64N/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k - \color{blue}{-10}\right)} \]
                        11. *-commutativeN/A

                          \[\leadsto \frac{a}{1 + \left(k - -10\right) \cdot \color{blue}{k}} \]
                        12. lower-+.f64N/A

                          \[\leadsto \frac{a}{1 + \color{blue}{\left(k - -10\right) \cdot k}} \]
                        13. +-commutativeN/A

                          \[\leadsto \frac{a}{\left(k - -10\right) \cdot k + \color{blue}{1}} \]
                        14. lift-fma.f6444.3%

                          \[\leadsto \frac{a}{\mathsf{fma}\left(k - -10, \color{blue}{k}, 1\right)} \]
                      6. Applied rewrites44.3%

                        \[\leadsto \frac{a}{\mathsf{fma}\left(k - -10, \color{blue}{k}, 1\right)} \]
                    4. Recombined 2 regimes into one program.
                    5. Add Preprocessing

                    Alternative 5: 56.9% accurate, 1.8× speedup?

                    \[\begin{array}{l} \mathbf{if}\;m \leq -20000000000:\\ \;\;\;\;\frac{a}{\sqrt{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\ \end{array} \]
                    (FPCore (a k m)
                     :precision binary64
                     (if (<= m -20000000000.0)
                       (/ a (sqrt (* (* k k) (* k k))))
                       (/ a (fma (- k -10.0) k 1.0))))
                    double code(double a, double k, double m) {
                    	double tmp;
                    	if (m <= -20000000000.0) {
                    		tmp = a / sqrt(((k * k) * (k * k)));
                    	} else {
                    		tmp = a / fma((k - -10.0), k, 1.0);
                    	}
                    	return tmp;
                    }
                    
                    function code(a, k, m)
                    	tmp = 0.0
                    	if (m <= -20000000000.0)
                    		tmp = Float64(a / sqrt(Float64(Float64(k * k) * Float64(k * k))));
                    	else
                    		tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0));
                    	end
                    	return tmp
                    end
                    
                    code[a_, k_, m_] := If[LessEqual[m, -20000000000.0], N[(a / N[Sqrt[N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    \mathbf{if}\;m \leq -20000000000:\\
                    \;\;\;\;\frac{a}{\sqrt{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if m < -2e10

                      1. Initial program 90.6%

                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                      2. Taylor expanded in m around 0

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

                          \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        2. lower-+.f64N/A

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

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                        4. lower-pow.f6444.3%

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                      4. Applied rewrites44.3%

                        \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                      5. Taylor expanded in k around inf

                        \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                      6. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                        2. lower-pow.f6435.8%

                          \[\leadsto \frac{a}{{k}^{2}} \]
                      7. Applied rewrites35.8%

                        \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                      8. Step-by-step derivation
                        1. lift-pow.f64N/A

                          \[\leadsto \frac{a}{{k}^{2}} \]
                        2. pow2N/A

                          \[\leadsto \frac{a}{k \cdot k} \]
                        3. fabs-sqrN/A

                          \[\leadsto \frac{a}{\left|k \cdot k\right|} \]
                        4. lift-*.f64N/A

                          \[\leadsto \frac{a}{\left|k \cdot k\right|} \]
                        5. neg-fabsN/A

                          \[\leadsto \frac{a}{\left|\mathsf{neg}\left(k \cdot k\right)\right|} \]
                        6. rem-sqrt-square-revN/A

                          \[\leadsto \frac{a}{\sqrt{\left(\mathsf{neg}\left(k \cdot k\right)\right) \cdot \left(\mathsf{neg}\left(k \cdot k\right)\right)}} \]
                        7. lower-*.f32N/A

                          \[\leadsto \frac{a}{\sqrt{\left(\mathsf{neg}\left(k \cdot k\right)\right) \cdot \left(\mathsf{neg}\left(k \cdot k\right)\right)}} \]
                        8. lower-unsound-*.f32N/A

                          \[\leadsto \frac{a}{\sqrt{\left(\mathsf{neg}\left(k \cdot k\right)\right) \cdot \left(\mathsf{neg}\left(k \cdot k\right)\right)}} \]
                        9. lower-sqrt.f64N/A

                          \[\leadsto \frac{a}{\sqrt{\left(\mathsf{neg}\left(k \cdot k\right)\right) \cdot \left(\mathsf{neg}\left(k \cdot k\right)\right)}} \]
                        10. lower-unsound-*.f32N/A

                          \[\leadsto \frac{a}{\sqrt{\left(\mathsf{neg}\left(k \cdot k\right)\right) \cdot \left(\mathsf{neg}\left(k \cdot k\right)\right)}} \]
                        11. lower-*.f32N/A

                          \[\leadsto \frac{a}{\sqrt{\left(\mathsf{neg}\left(k \cdot k\right)\right) \cdot \left(\mathsf{neg}\left(k \cdot k\right)\right)}} \]
                        12. sqr-neg-revN/A

                          \[\leadsto \frac{a}{\sqrt{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}} \]
                        13. lower-*.f6438.0%

                          \[\leadsto \frac{a}{\sqrt{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}} \]
                      9. Applied rewrites38.0%

                        \[\leadsto \frac{a}{\sqrt{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}} \]

                      if -2e10 < m

                      1. Initial program 90.6%

                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                      2. Taylor expanded in m around 0

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

                          \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        2. lower-+.f64N/A

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

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                        4. lower-pow.f6444.3%

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                      4. Applied rewrites44.3%

                        \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                      5. Step-by-step derivation
                        1. lift-fma.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \]
                        2. lift-pow.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + {k}^{\color{blue}{2}}\right)} \]
                        3. pow2N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)} \]
                        4. lift-*.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)} \]
                        5. +-commutativeN/A

                          \[\leadsto \frac{a}{1 + \left(k \cdot k + \color{blue}{10 \cdot k}\right)} \]
                        6. lift-*.f64N/A

                          \[\leadsto \frac{a}{1 + \left(k \cdot k + \color{blue}{10} \cdot k\right)} \]
                        7. distribute-rgt-outN/A

                          \[\leadsto \frac{a}{1 + k \cdot \color{blue}{\left(k + 10\right)}} \]
                        8. metadata-evalN/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k + \left(\mathsf{neg}\left(-10\right)\right)\right)} \]
                        9. sub-flipN/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k - \color{blue}{-10}\right)} \]
                        10. lift--.f64N/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k - \color{blue}{-10}\right)} \]
                        11. *-commutativeN/A

                          \[\leadsto \frac{a}{1 + \left(k - -10\right) \cdot \color{blue}{k}} \]
                        12. lower-+.f64N/A

                          \[\leadsto \frac{a}{1 + \color{blue}{\left(k - -10\right) \cdot k}} \]
                        13. +-commutativeN/A

                          \[\leadsto \frac{a}{\left(k - -10\right) \cdot k + \color{blue}{1}} \]
                        14. lift-fma.f6444.3%

                          \[\leadsto \frac{a}{\mathsf{fma}\left(k - -10, \color{blue}{k}, 1\right)} \]
                      6. Applied rewrites44.3%

                        \[\leadsto \frac{a}{\mathsf{fma}\left(k - -10, \color{blue}{k}, 1\right)} \]
                    3. Recombined 2 regimes into one program.
                    4. Add Preprocessing

                    Alternative 6: 52.5% accurate, 2.2× speedup?

                    \[\begin{array}{l} \mathbf{if}\;m \leq -33000000000:\\ \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\ \end{array} \]
                    (FPCore (a k m)
                     :precision binary64
                     (if (<= m -33000000000.0)
                       (/ 1.0 (/ (* k k) a))
                       (/ a (fma (- k -10.0) k 1.0))))
                    double code(double a, double k, double m) {
                    	double tmp;
                    	if (m <= -33000000000.0) {
                    		tmp = 1.0 / ((k * k) / a);
                    	} else {
                    		tmp = a / fma((k - -10.0), k, 1.0);
                    	}
                    	return tmp;
                    }
                    
                    function code(a, k, m)
                    	tmp = 0.0
                    	if (m <= -33000000000.0)
                    		tmp = Float64(1.0 / Float64(Float64(k * k) / a));
                    	else
                    		tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0));
                    	end
                    	return tmp
                    end
                    
                    code[a_, k_, m_] := If[LessEqual[m, -33000000000.0], N[(1.0 / N[(N[(k * k), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    \mathbf{if}\;m \leq -33000000000:\\
                    \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if m < -3.3e10

                      1. Initial program 90.6%

                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                      2. Taylor expanded in m around 0

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

                          \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        2. lower-+.f64N/A

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

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                        4. lower-pow.f6444.3%

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                      4. Applied rewrites44.3%

                        \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                      5. Taylor expanded in k around inf

                        \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                      6. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                        2. lower-pow.f6435.8%

                          \[\leadsto \frac{a}{{k}^{2}} \]
                      7. Applied rewrites35.8%

                        \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                      8. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                        2. lift-pow.f64N/A

                          \[\leadsto \frac{a}{{k}^{2}} \]
                        3. pow2N/A

                          \[\leadsto \frac{a}{k \cdot k} \]
                        4. lift-*.f64N/A

                          \[\leadsto \frac{a}{k \cdot k} \]
                        5. div-flipN/A

                          \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
                        6. lower-unsound-/.f64N/A

                          \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
                        7. lower-unsound-/.f6435.8%

                          \[\leadsto \frac{1}{\frac{k \cdot k}{a}} \]
                      9. Applied rewrites35.8%

                        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]

                      if -3.3e10 < m

                      1. Initial program 90.6%

                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                      2. Taylor expanded in m around 0

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

                          \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        2. lower-+.f64N/A

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

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                        4. lower-pow.f6444.3%

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                      4. Applied rewrites44.3%

                        \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                      5. Step-by-step derivation
                        1. lift-fma.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + \color{blue}{{k}^{2}}\right)} \]
                        2. lift-pow.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + {k}^{\color{blue}{2}}\right)} \]
                        3. pow2N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)} \]
                        4. lift-*.f64N/A

                          \[\leadsto \frac{a}{1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)} \]
                        5. +-commutativeN/A

                          \[\leadsto \frac{a}{1 + \left(k \cdot k + \color{blue}{10 \cdot k}\right)} \]
                        6. lift-*.f64N/A

                          \[\leadsto \frac{a}{1 + \left(k \cdot k + \color{blue}{10} \cdot k\right)} \]
                        7. distribute-rgt-outN/A

                          \[\leadsto \frac{a}{1 + k \cdot \color{blue}{\left(k + 10\right)}} \]
                        8. metadata-evalN/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k + \left(\mathsf{neg}\left(-10\right)\right)\right)} \]
                        9. sub-flipN/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k - \color{blue}{-10}\right)} \]
                        10. lift--.f64N/A

                          \[\leadsto \frac{a}{1 + k \cdot \left(k - \color{blue}{-10}\right)} \]
                        11. *-commutativeN/A

                          \[\leadsto \frac{a}{1 + \left(k - -10\right) \cdot \color{blue}{k}} \]
                        12. lower-+.f64N/A

                          \[\leadsto \frac{a}{1 + \color{blue}{\left(k - -10\right) \cdot k}} \]
                        13. +-commutativeN/A

                          \[\leadsto \frac{a}{\left(k - -10\right) \cdot k + \color{blue}{1}} \]
                        14. lift-fma.f6444.3%

                          \[\leadsto \frac{a}{\mathsf{fma}\left(k - -10, \color{blue}{k}, 1\right)} \]
                      6. Applied rewrites44.3%

                        \[\leadsto \frac{a}{\mathsf{fma}\left(k - -10, \color{blue}{k}, 1\right)} \]
                    3. Recombined 2 regimes into one program.
                    4. Add Preprocessing

                    Alternative 7: 47.1% accurate, 1.9× speedup?

                    \[\begin{array}{l} \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\ \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{k} \cdot a}{k}\\ \end{array} \]
                    (FPCore (a k m)
                     :precision binary64
                     (if (<= k 3.5e-307)
                       (/ 1.0 (/ (* k k) a))
                       (if (<= k 2.15e-5) (fma (* a -10.0) k a) (/ (* (/ 1.0 k) a) k))))
                    double code(double a, double k, double m) {
                    	double tmp;
                    	if (k <= 3.5e-307) {
                    		tmp = 1.0 / ((k * k) / a);
                    	} else if (k <= 2.15e-5) {
                    		tmp = fma((a * -10.0), k, a);
                    	} else {
                    		tmp = ((1.0 / k) * a) / k;
                    	}
                    	return tmp;
                    }
                    
                    function code(a, k, m)
                    	tmp = 0.0
                    	if (k <= 3.5e-307)
                    		tmp = Float64(1.0 / Float64(Float64(k * k) / a));
                    	elseif (k <= 2.15e-5)
                    		tmp = fma(Float64(a * -10.0), k, a);
                    	else
                    		tmp = Float64(Float64(Float64(1.0 / k) * a) / k);
                    	end
                    	return tmp
                    end
                    
                    code[a_, k_, m_] := If[LessEqual[k, 3.5e-307], N[(1.0 / N[(N[(k * k), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.15e-5], N[(N[(a * -10.0), $MachinePrecision] * k + a), $MachinePrecision], N[(N[(N[(1.0 / k), $MachinePrecision] * a), $MachinePrecision] / k), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\
                    \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\
                    
                    \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\
                    \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{\frac{1}{k} \cdot a}{k}\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if k < 3.5000000000000002e-307

                      1. Initial program 90.6%

                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                      2. Taylor expanded in m around 0

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

                          \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        2. lower-+.f64N/A

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

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                        4. lower-pow.f6444.3%

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                      4. Applied rewrites44.3%

                        \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                      5. Taylor expanded in k around inf

                        \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                      6. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                        2. lower-pow.f6435.8%

                          \[\leadsto \frac{a}{{k}^{2}} \]
                      7. Applied rewrites35.8%

                        \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                      8. Step-by-step derivation
                        1. lift-/.f64N/A

                          \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                        2. lift-pow.f64N/A

                          \[\leadsto \frac{a}{{k}^{2}} \]
                        3. pow2N/A

                          \[\leadsto \frac{a}{k \cdot k} \]
                        4. lift-*.f64N/A

                          \[\leadsto \frac{a}{k \cdot k} \]
                        5. div-flipN/A

                          \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
                        6. lower-unsound-/.f64N/A

                          \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
                        7. lower-unsound-/.f6435.8%

                          \[\leadsto \frac{1}{\frac{k \cdot k}{a}} \]
                      9. Applied rewrites35.8%

                        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]

                      if 3.5000000000000002e-307 < k < 2.1500000000000001e-5

                      1. Initial program 90.6%

                        \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                      2. Taylor expanded in m around 0

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

                          \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                        2. lower-+.f64N/A

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

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                        4. lower-pow.f6444.3%

                          \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                      4. Applied rewrites44.3%

                        \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                      5. Taylor expanded in k around 0

                        \[\leadsto \frac{a}{1} \]
                      6. Step-by-step derivation
                        1. Applied rewrites19.8%

                          \[\leadsto \frac{a}{1} \]
                        2. Taylor expanded in k around 0

                          \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                        3. Step-by-step derivation
                          1. lower-+.f64N/A

                            \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                          2. lower-*.f64N/A

                            \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                          3. lower-*.f6420.7%

                            \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                        4. Applied rewrites20.7%

                          \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                        5. Step-by-step derivation
                          1. lift-+.f64N/A

                            \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                          2. +-commutativeN/A

                            \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                          3. lift-*.f64N/A

                            \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                          4. lift-*.f64N/A

                            \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                          5. associate-*r*N/A

                            \[\leadsto \left(-10 \cdot a\right) \cdot k + a \]
                          6. lower-fma.f64N/A

                            \[\leadsto \mathsf{fma}\left(-10 \cdot a, k, a\right) \]
                          7. *-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                          8. lower-*.f6420.7%

                            \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                        6. Applied rewrites20.7%

                          \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]

                        if 2.1500000000000001e-5 < k

                        1. Initial program 90.6%

                          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                        2. Taylor expanded in m around 0

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

                            \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                          2. lower-+.f64N/A

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

                            \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                          4. lower-pow.f6444.3%

                            \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                        4. Applied rewrites44.3%

                          \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                        5. Taylor expanded in k around inf

                          \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                        6. Step-by-step derivation
                          1. lower-/.f64N/A

                            \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                          2. lower-pow.f6435.8%

                            \[\leadsto \frac{a}{{k}^{2}} \]
                        7. Applied rewrites35.8%

                          \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                        8. Step-by-step derivation
                          1. lift-/.f64N/A

                            \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                          2. lift-pow.f64N/A

                            \[\leadsto \frac{a}{{k}^{2}} \]
                          3. pow2N/A

                            \[\leadsto \frac{a}{k \cdot k} \]
                          4. lift-*.f64N/A

                            \[\leadsto \frac{a}{k \cdot k} \]
                          5. mult-flipN/A

                            \[\leadsto a \cdot \frac{1}{\color{blue}{k \cdot k}} \]
                          6. *-commutativeN/A

                            \[\leadsto \frac{1}{k \cdot k} \cdot a \]
                          7. lift-*.f64N/A

                            \[\leadsto \frac{1}{k \cdot k} \cdot a \]
                          8. associate-/r*N/A

                            \[\leadsto \frac{\frac{1}{k}}{k} \cdot a \]
                          9. associate-*l/N/A

                            \[\leadsto \frac{\frac{1}{k} \cdot a}{k} \]
                          10. lower-/.f64N/A

                            \[\leadsto \frac{\frac{1}{k} \cdot a}{k} \]
                          11. lower-*.f64N/A

                            \[\leadsto \frac{\frac{1}{k} \cdot a}{k} \]
                          12. lower-/.f6434.3%

                            \[\leadsto \frac{\frac{1}{k} \cdot a}{k} \]
                        9. Applied rewrites34.3%

                          \[\leadsto \frac{\frac{1}{k} \cdot a}{k} \]
                      7. Recombined 3 regimes into one program.
                      8. Add Preprocessing

                      Alternative 8: 47.1% accurate, 1.9× speedup?

                      \[\begin{array}{l} \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\ \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\ \end{array} \]
                      (FPCore (a k m)
                       :precision binary64
                       (if (<= k 3.5e-307)
                         (/ 1.0 (/ (* k k) a))
                         (if (<= k 2.15e-5) (fma (* a -10.0) k a) (* (/ a k) (/ 1.0 k)))))
                      double code(double a, double k, double m) {
                      	double tmp;
                      	if (k <= 3.5e-307) {
                      		tmp = 1.0 / ((k * k) / a);
                      	} else if (k <= 2.15e-5) {
                      		tmp = fma((a * -10.0), k, a);
                      	} else {
                      		tmp = (a / k) * (1.0 / k);
                      	}
                      	return tmp;
                      }
                      
                      function code(a, k, m)
                      	tmp = 0.0
                      	if (k <= 3.5e-307)
                      		tmp = Float64(1.0 / Float64(Float64(k * k) / a));
                      	elseif (k <= 2.15e-5)
                      		tmp = fma(Float64(a * -10.0), k, a);
                      	else
                      		tmp = Float64(Float64(a / k) * Float64(1.0 / k));
                      	end
                      	return tmp
                      end
                      
                      code[a_, k_, m_] := If[LessEqual[k, 3.5e-307], N[(1.0 / N[(N[(k * k), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.15e-5], N[(N[(a * -10.0), $MachinePrecision] * k + a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\
                      \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\
                      
                      \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\
                      \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\
                      
                      
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if k < 3.5000000000000002e-307

                        1. Initial program 90.6%

                          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                        2. Taylor expanded in m around 0

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

                            \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                          2. lower-+.f64N/A

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

                            \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                          4. lower-pow.f6444.3%

                            \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                        4. Applied rewrites44.3%

                          \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                        5. Taylor expanded in k around inf

                          \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                        6. Step-by-step derivation
                          1. lower-/.f64N/A

                            \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                          2. lower-pow.f6435.8%

                            \[\leadsto \frac{a}{{k}^{2}} \]
                        7. Applied rewrites35.8%

                          \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                        8. Step-by-step derivation
                          1. lift-/.f64N/A

                            \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                          2. lift-pow.f64N/A

                            \[\leadsto \frac{a}{{k}^{2}} \]
                          3. pow2N/A

                            \[\leadsto \frac{a}{k \cdot k} \]
                          4. lift-*.f64N/A

                            \[\leadsto \frac{a}{k \cdot k} \]
                          5. div-flipN/A

                            \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
                          6. lower-unsound-/.f64N/A

                            \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
                          7. lower-unsound-/.f6435.8%

                            \[\leadsto \frac{1}{\frac{k \cdot k}{a}} \]
                        9. Applied rewrites35.8%

                          \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]

                        if 3.5000000000000002e-307 < k < 2.1500000000000001e-5

                        1. Initial program 90.6%

                          \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                        2. Taylor expanded in m around 0

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

                            \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                          2. lower-+.f64N/A

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

                            \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                          4. lower-pow.f6444.3%

                            \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                        4. Applied rewrites44.3%

                          \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                        5. Taylor expanded in k around 0

                          \[\leadsto \frac{a}{1} \]
                        6. Step-by-step derivation
                          1. Applied rewrites19.8%

                            \[\leadsto \frac{a}{1} \]
                          2. Taylor expanded in k around 0

                            \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                          3. Step-by-step derivation
                            1. lower-+.f64N/A

                              \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                            2. lower-*.f64N/A

                              \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                            3. lower-*.f6420.7%

                              \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                          4. Applied rewrites20.7%

                            \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                          5. Step-by-step derivation
                            1. lift-+.f64N/A

                              \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                            2. +-commutativeN/A

                              \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                            3. lift-*.f64N/A

                              \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                            4. lift-*.f64N/A

                              \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                            5. associate-*r*N/A

                              \[\leadsto \left(-10 \cdot a\right) \cdot k + a \]
                            6. lower-fma.f64N/A

                              \[\leadsto \mathsf{fma}\left(-10 \cdot a, k, a\right) \]
                            7. *-commutativeN/A

                              \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                            8. lower-*.f6420.7%

                              \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                          6. Applied rewrites20.7%

                            \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]

                          if 2.1500000000000001e-5 < k

                          1. Initial program 90.6%

                            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                          2. Taylor expanded in m around 0

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

                              \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                            2. lower-+.f64N/A

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

                              \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                            4. lower-pow.f6444.3%

                              \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                          4. Applied rewrites44.3%

                            \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                          5. Taylor expanded in k around inf

                            \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                          6. Step-by-step derivation
                            1. lower-/.f64N/A

                              \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                            2. lower-pow.f6435.8%

                              \[\leadsto \frac{a}{{k}^{2}} \]
                          7. Applied rewrites35.8%

                            \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                          8. Step-by-step derivation
                            1. lift-/.f64N/A

                              \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                            2. lift-pow.f64N/A

                              \[\leadsto \frac{a}{{k}^{2}} \]
                            3. pow2N/A

                              \[\leadsto \frac{a}{k \cdot k} \]
                            4. *-rgt-identityN/A

                              \[\leadsto \frac{a \cdot 1}{k \cdot k} \]
                            5. times-fracN/A

                              \[\leadsto \frac{a}{k} \cdot \frac{1}{\color{blue}{k}} \]
                            6. lower-*.f64N/A

                              \[\leadsto \frac{a}{k} \cdot \frac{1}{\color{blue}{k}} \]
                            7. lower-/.f64N/A

                              \[\leadsto \frac{a}{k} \cdot \frac{1}{k} \]
                            8. lower-/.f6434.3%

                              \[\leadsto \frac{a}{k} \cdot \frac{1}{k} \]
                          9. Applied rewrites34.3%

                            \[\leadsto \frac{a}{k} \cdot \frac{1}{\color{blue}{k}} \]
                        7. Recombined 3 regimes into one program.
                        8. Add Preprocessing

                        Alternative 9: 47.1% accurate, 1.9× speedup?

                        \[\begin{array}{l} \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\ \end{array} \]
                        (FPCore (a k m)
                         :precision binary64
                         (if (<= k 3.5e-307)
                           (/ a (* k k))
                           (if (<= k 2.15e-5) (fma (* a -10.0) k a) (* (/ a k) (/ 1.0 k)))))
                        double code(double a, double k, double m) {
                        	double tmp;
                        	if (k <= 3.5e-307) {
                        		tmp = a / (k * k);
                        	} else if (k <= 2.15e-5) {
                        		tmp = fma((a * -10.0), k, a);
                        	} else {
                        		tmp = (a / k) * (1.0 / k);
                        	}
                        	return tmp;
                        }
                        
                        function code(a, k, m)
                        	tmp = 0.0
                        	if (k <= 3.5e-307)
                        		tmp = Float64(a / Float64(k * k));
                        	elseif (k <= 2.15e-5)
                        		tmp = fma(Float64(a * -10.0), k, a);
                        	else
                        		tmp = Float64(Float64(a / k) * Float64(1.0 / k));
                        	end
                        	return tmp
                        end
                        
                        code[a_, k_, m_] := If[LessEqual[k, 3.5e-307], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.15e-5], N[(N[(a * -10.0), $MachinePrecision] * k + a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]]]
                        
                        \begin{array}{l}
                        \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\
                        \;\;\;\;\frac{a}{k \cdot k}\\
                        
                        \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\
                        \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\
                        
                        
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if k < 3.5000000000000002e-307

                          1. Initial program 90.6%

                            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                          2. Taylor expanded in m around 0

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

                              \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                            2. lower-+.f64N/A

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

                              \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                            4. lower-pow.f6444.3%

                              \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                          4. Applied rewrites44.3%

                            \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                          5. Taylor expanded in k around inf

                            \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                          6. Step-by-step derivation
                            1. lower-/.f64N/A

                              \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                            2. lower-pow.f6435.8%

                              \[\leadsto \frac{a}{{k}^{2}} \]
                          7. Applied rewrites35.8%

                            \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                          8. Step-by-step derivation
                            1. lift-pow.f64N/A

                              \[\leadsto \frac{a}{{k}^{2}} \]
                            2. pow2N/A

                              \[\leadsto \frac{a}{k \cdot k} \]
                            3. lift-*.f6435.8%

                              \[\leadsto \frac{a}{k \cdot k} \]
                          9. Applied rewrites35.8%

                            \[\leadsto \frac{a}{k \cdot k} \]

                          if 3.5000000000000002e-307 < k < 2.1500000000000001e-5

                          1. Initial program 90.6%

                            \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                          2. Taylor expanded in m around 0

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

                              \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                            2. lower-+.f64N/A

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

                              \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                            4. lower-pow.f6444.3%

                              \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                          4. Applied rewrites44.3%

                            \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                          5. Taylor expanded in k around 0

                            \[\leadsto \frac{a}{1} \]
                          6. Step-by-step derivation
                            1. Applied rewrites19.8%

                              \[\leadsto \frac{a}{1} \]
                            2. Taylor expanded in k around 0

                              \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                            3. Step-by-step derivation
                              1. lower-+.f64N/A

                                \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                              2. lower-*.f64N/A

                                \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                              3. lower-*.f6420.7%

                                \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                            4. Applied rewrites20.7%

                              \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                            5. Step-by-step derivation
                              1. lift-+.f64N/A

                                \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                              2. +-commutativeN/A

                                \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                              3. lift-*.f64N/A

                                \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                              4. lift-*.f64N/A

                                \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                              5. associate-*r*N/A

                                \[\leadsto \left(-10 \cdot a\right) \cdot k + a \]
                              6. lower-fma.f64N/A

                                \[\leadsto \mathsf{fma}\left(-10 \cdot a, k, a\right) \]
                              7. *-commutativeN/A

                                \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                              8. lower-*.f6420.7%

                                \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                            6. Applied rewrites20.7%

                              \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]

                            if 2.1500000000000001e-5 < k

                            1. Initial program 90.6%

                              \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                            2. Taylor expanded in m around 0

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

                                \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                              2. lower-+.f64N/A

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

                                \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                              4. lower-pow.f6444.3%

                                \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                            4. Applied rewrites44.3%

                              \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                            5. Taylor expanded in k around inf

                              \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                            6. Step-by-step derivation
                              1. lower-/.f64N/A

                                \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                              2. lower-pow.f6435.8%

                                \[\leadsto \frac{a}{{k}^{2}} \]
                            7. Applied rewrites35.8%

                              \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                            8. Step-by-step derivation
                              1. lift-/.f64N/A

                                \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                              2. lift-pow.f64N/A

                                \[\leadsto \frac{a}{{k}^{2}} \]
                              3. pow2N/A

                                \[\leadsto \frac{a}{k \cdot k} \]
                              4. *-rgt-identityN/A

                                \[\leadsto \frac{a \cdot 1}{k \cdot k} \]
                              5. times-fracN/A

                                \[\leadsto \frac{a}{k} \cdot \frac{1}{\color{blue}{k}} \]
                              6. lower-*.f64N/A

                                \[\leadsto \frac{a}{k} \cdot \frac{1}{\color{blue}{k}} \]
                              7. lower-/.f64N/A

                                \[\leadsto \frac{a}{k} \cdot \frac{1}{k} \]
                              8. lower-/.f6434.3%

                                \[\leadsto \frac{a}{k} \cdot \frac{1}{k} \]
                            9. Applied rewrites34.3%

                              \[\leadsto \frac{a}{k} \cdot \frac{1}{\color{blue}{k}} \]
                          7. Recombined 3 regimes into one program.
                          8. Add Preprocessing

                          Alternative 10: 47.0% accurate, 2.2× speedup?

                          \[\begin{array}{l} \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
                          (FPCore (a k m)
                           :precision binary64
                           (if (<= k 3.5e-307)
                             (/ a (* k k))
                             (if (<= k 2.15e-5) (fma (* a -10.0) k a) (/ (/ a k) k))))
                          double code(double a, double k, double m) {
                          	double tmp;
                          	if (k <= 3.5e-307) {
                          		tmp = a / (k * k);
                          	} else if (k <= 2.15e-5) {
                          		tmp = fma((a * -10.0), k, a);
                          	} else {
                          		tmp = (a / k) / k;
                          	}
                          	return tmp;
                          }
                          
                          function code(a, k, m)
                          	tmp = 0.0
                          	if (k <= 3.5e-307)
                          		tmp = Float64(a / Float64(k * k));
                          	elseif (k <= 2.15e-5)
                          		tmp = fma(Float64(a * -10.0), k, a);
                          	else
                          		tmp = Float64(Float64(a / k) / k);
                          	end
                          	return tmp
                          end
                          
                          code[a_, k_, m_] := If[LessEqual[k, 3.5e-307], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.15e-5], N[(N[(a * -10.0), $MachinePrecision] * k + a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\
                          \;\;\;\;\frac{a}{k \cdot k}\\
                          
                          \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\
                          \;\;\;\;\mathsf{fma}\left(a \cdot -10, k, a\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{\frac{a}{k}}{k}\\
                          
                          
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if k < 3.5000000000000002e-307

                            1. Initial program 90.6%

                              \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                            2. Taylor expanded in m around 0

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

                                \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                              2. lower-+.f64N/A

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

                                \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                              4. lower-pow.f6444.3%

                                \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                            4. Applied rewrites44.3%

                              \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                            5. Taylor expanded in k around inf

                              \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                            6. Step-by-step derivation
                              1. lower-/.f64N/A

                                \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                              2. lower-pow.f6435.8%

                                \[\leadsto \frac{a}{{k}^{2}} \]
                            7. Applied rewrites35.8%

                              \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                            8. Step-by-step derivation
                              1. lift-pow.f64N/A

                                \[\leadsto \frac{a}{{k}^{2}} \]
                              2. pow2N/A

                                \[\leadsto \frac{a}{k \cdot k} \]
                              3. lift-*.f6435.8%

                                \[\leadsto \frac{a}{k \cdot k} \]
                            9. Applied rewrites35.8%

                              \[\leadsto \frac{a}{k \cdot k} \]

                            if 3.5000000000000002e-307 < k < 2.1500000000000001e-5

                            1. Initial program 90.6%

                              \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                            2. Taylor expanded in m around 0

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

                                \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                              2. lower-+.f64N/A

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

                                \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                              4. lower-pow.f6444.3%

                                \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                            4. Applied rewrites44.3%

                              \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                            5. Taylor expanded in k around 0

                              \[\leadsto \frac{a}{1} \]
                            6. Step-by-step derivation
                              1. Applied rewrites19.8%

                                \[\leadsto \frac{a}{1} \]
                              2. Taylor expanded in k around 0

                                \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                              3. Step-by-step derivation
                                1. lower-+.f64N/A

                                  \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                                2. lower-*.f64N/A

                                  \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                                3. lower-*.f6420.7%

                                  \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                              4. Applied rewrites20.7%

                                \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                              5. Step-by-step derivation
                                1. lift-+.f64N/A

                                  \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                                2. +-commutativeN/A

                                  \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                                3. lift-*.f64N/A

                                  \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                                4. lift-*.f64N/A

                                  \[\leadsto -10 \cdot \left(a \cdot k\right) + a \]
                                5. associate-*r*N/A

                                  \[\leadsto \left(-10 \cdot a\right) \cdot k + a \]
                                6. lower-fma.f64N/A

                                  \[\leadsto \mathsf{fma}\left(-10 \cdot a, k, a\right) \]
                                7. *-commutativeN/A

                                  \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                                8. lower-*.f6420.7%

                                  \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]
                              6. Applied rewrites20.7%

                                \[\leadsto \mathsf{fma}\left(a \cdot -10, k, a\right) \]

                              if 2.1500000000000001e-5 < k

                              1. Initial program 90.6%

                                \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                              2. Taylor expanded in m around 0

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

                                  \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                2. lower-+.f64N/A

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

                                  \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                4. lower-pow.f6444.3%

                                  \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                              4. Applied rewrites44.3%

                                \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                              5. Taylor expanded in k around inf

                                \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                              6. Step-by-step derivation
                                1. lower-/.f64N/A

                                  \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                2. lower-pow.f6435.8%

                                  \[\leadsto \frac{a}{{k}^{2}} \]
                              7. Applied rewrites35.8%

                                \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                              8. Step-by-step derivation
                                1. lift-/.f64N/A

                                  \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                2. lift-pow.f64N/A

                                  \[\leadsto \frac{a}{{k}^{2}} \]
                                3. pow2N/A

                                  \[\leadsto \frac{a}{k \cdot k} \]
                                4. associate-/r*N/A

                                  \[\leadsto \frac{\frac{a}{k}}{k} \]
                                5. lower-/.f64N/A

                                  \[\leadsto \frac{\frac{a}{k}}{k} \]
                                6. lower-/.f6434.3%

                                  \[\leadsto \frac{\frac{a}{k}}{k} \]
                              9. Applied rewrites34.3%

                                \[\leadsto \frac{\frac{a}{k}}{k} \]
                            7. Recombined 3 regimes into one program.
                            8. Add Preprocessing

                            Alternative 11: 47.0% accurate, 2.2× speedup?

                            \[\begin{array}{l} \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
                            (FPCore (a k m)
                             :precision binary64
                             (if (<= k 3.5e-307)
                               (/ a (* k k))
                               (if (<= k 2.15e-5) (* (fma -10.0 k 1.0) a) (/ (/ a k) k))))
                            double code(double a, double k, double m) {
                            	double tmp;
                            	if (k <= 3.5e-307) {
                            		tmp = a / (k * k);
                            	} else if (k <= 2.15e-5) {
                            		tmp = fma(-10.0, k, 1.0) * a;
                            	} else {
                            		tmp = (a / k) / k;
                            	}
                            	return tmp;
                            }
                            
                            function code(a, k, m)
                            	tmp = 0.0
                            	if (k <= 3.5e-307)
                            		tmp = Float64(a / Float64(k * k));
                            	elseif (k <= 2.15e-5)
                            		tmp = Float64(fma(-10.0, k, 1.0) * a);
                            	else
                            		tmp = Float64(Float64(a / k) / k);
                            	end
                            	return tmp
                            end
                            
                            code[a_, k_, m_] := If[LessEqual[k, 3.5e-307], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.15e-5], N[(N[(-10.0 * k + 1.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
                            
                            \begin{array}{l}
                            \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\
                            \;\;\;\;\frac{a}{k \cdot k}\\
                            
                            \mathbf{elif}\;k \leq 2.15 \cdot 10^{-5}:\\
                            \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{\frac{a}{k}}{k}\\
                            
                            
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if k < 3.5000000000000002e-307

                              1. Initial program 90.6%

                                \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                              2. Taylor expanded in m around 0

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

                                  \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                2. lower-+.f64N/A

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

                                  \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                4. lower-pow.f6444.3%

                                  \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                              4. Applied rewrites44.3%

                                \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                              5. Taylor expanded in k around inf

                                \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                              6. Step-by-step derivation
                                1. lower-/.f64N/A

                                  \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                2. lower-pow.f6435.8%

                                  \[\leadsto \frac{a}{{k}^{2}} \]
                              7. Applied rewrites35.8%

                                \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                              8. Step-by-step derivation
                                1. lift-pow.f64N/A

                                  \[\leadsto \frac{a}{{k}^{2}} \]
                                2. pow2N/A

                                  \[\leadsto \frac{a}{k \cdot k} \]
                                3. lift-*.f6435.8%

                                  \[\leadsto \frac{a}{k \cdot k} \]
                              9. Applied rewrites35.8%

                                \[\leadsto \frac{a}{k \cdot k} \]

                              if 3.5000000000000002e-307 < k < 2.1500000000000001e-5

                              1. Initial program 90.6%

                                \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                              2. Taylor expanded in m around 0

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

                                  \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                2. lower-+.f64N/A

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

                                  \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                4. lower-pow.f6444.3%

                                  \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                              4. Applied rewrites44.3%

                                \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                              5. Taylor expanded in k around 0

                                \[\leadsto \frac{a}{1} \]
                              6. Step-by-step derivation
                                1. Applied rewrites19.8%

                                  \[\leadsto \frac{a}{1} \]
                                2. Taylor expanded in k around 0

                                  \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                                3. Step-by-step derivation
                                  1. lower-+.f64N/A

                                    \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                                  2. lower-*.f64N/A

                                    \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                                  3. lower-*.f6420.7%

                                    \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                                4. Applied rewrites20.7%

                                  \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                                5. Step-by-step derivation
                                  1. lift-+.f64N/A

                                    \[\leadsto a + -10 \cdot \color{blue}{\left(a \cdot k\right)} \]
                                  2. lift-*.f64N/A

                                    \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                                  3. lift-*.f64N/A

                                    \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                                  4. *-commutativeN/A

                                    \[\leadsto a + -10 \cdot \left(k \cdot a\right) \]
                                  5. associate-*r*N/A

                                    \[\leadsto a + \left(-10 \cdot k\right) \cdot a \]
                                  6. metadata-evalN/A

                                    \[\leadsto a + \left(\left(\mathsf{neg}\left(10\right)\right) \cdot k\right) \cdot a \]
                                  7. distribute-lft-neg-outN/A

                                    \[\leadsto a + \left(\mathsf{neg}\left(10 \cdot k\right)\right) \cdot a \]
                                  8. distribute-rgt1-inN/A

                                    \[\leadsto \left(\left(\mathsf{neg}\left(10 \cdot k\right)\right) + 1\right) \cdot a \]
                                  9. lower-*.f64N/A

                                    \[\leadsto \left(\left(\mathsf{neg}\left(10 \cdot k\right)\right) + 1\right) \cdot a \]
                                  10. distribute-lft-neg-outN/A

                                    \[\leadsto \left(\left(\mathsf{neg}\left(10\right)\right) \cdot k + 1\right) \cdot a \]
                                  11. metadata-evalN/A

                                    \[\leadsto \left(-10 \cdot k + 1\right) \cdot a \]
                                  12. lower-fma.f6420.7%

                                    \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot a \]
                                6. Applied rewrites20.7%

                                  \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot a \]

                                if 2.1500000000000001e-5 < k

                                1. Initial program 90.6%

                                  \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                2. Taylor expanded in m around 0

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

                                    \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                  2. lower-+.f64N/A

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

                                    \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                  4. lower-pow.f6444.3%

                                    \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                                4. Applied rewrites44.3%

                                  \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                                5. Taylor expanded in k around inf

                                  \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                6. Step-by-step derivation
                                  1. lower-/.f64N/A

                                    \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                  2. lower-pow.f6435.8%

                                    \[\leadsto \frac{a}{{k}^{2}} \]
                                7. Applied rewrites35.8%

                                  \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                8. Step-by-step derivation
                                  1. lift-/.f64N/A

                                    \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                  2. lift-pow.f64N/A

                                    \[\leadsto \frac{a}{{k}^{2}} \]
                                  3. pow2N/A

                                    \[\leadsto \frac{a}{k \cdot k} \]
                                  4. associate-/r*N/A

                                    \[\leadsto \frac{\frac{a}{k}}{k} \]
                                  5. lower-/.f64N/A

                                    \[\leadsto \frac{\frac{a}{k}}{k} \]
                                  6. lower-/.f6434.3%

                                    \[\leadsto \frac{\frac{a}{k}}{k} \]
                                9. Applied rewrites34.3%

                                  \[\leadsto \frac{\frac{a}{k}}{k} \]
                              7. Recombined 3 regimes into one program.
                              8. Add Preprocessing

                              Alternative 12: 46.4% accurate, 2.2× speedup?

                              \[\begin{array}{l} \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 6 \cdot 10^{+21}:\\ \;\;\;\;\frac{a}{1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
                              (FPCore (a k m)
                               :precision binary64
                               (if (<= k 3.5e-307) (/ a (* k k)) (if (<= k 6e+21) (/ a 1.0) (/ (/ a k) k))))
                              double code(double a, double k, double m) {
                              	double tmp;
                              	if (k <= 3.5e-307) {
                              		tmp = a / (k * k);
                              	} else if (k <= 6e+21) {
                              		tmp = a / 1.0;
                              	} else {
                              		tmp = (a / k) / k;
                              	}
                              	return tmp;
                              }
                              
                              module fmin_fmax_functions
                                  implicit none
                                  private
                                  public fmax
                                  public fmin
                              
                                  interface fmax
                                      module procedure fmax88
                                      module procedure fmax44
                                      module procedure fmax84
                                      module procedure fmax48
                                  end interface
                                  interface fmin
                                      module procedure fmin88
                                      module procedure fmin44
                                      module procedure fmin84
                                      module procedure fmin48
                                  end interface
                              contains
                                  real(8) function fmax88(x, y) result (res)
                                      real(8), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                  end function
                                  real(4) function fmax44(x, y) result (res)
                                      real(4), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                  end function
                                  real(8) function fmax84(x, y) result(res)
                                      real(8), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                  end function
                                  real(8) function fmax48(x, y) result(res)
                                      real(4), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                  end function
                                  real(8) function fmin88(x, y) result (res)
                                      real(8), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                  end function
                                  real(4) function fmin44(x, y) result (res)
                                      real(4), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                  end function
                                  real(8) function fmin84(x, y) result(res)
                                      real(8), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                  end function
                                  real(8) function fmin48(x, y) result(res)
                                      real(4), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                  end function
                              end module
                              
                              real(8) function code(a, k, m)
                              use fmin_fmax_functions
                                  real(8), intent (in) :: a
                                  real(8), intent (in) :: k
                                  real(8), intent (in) :: m
                                  real(8) :: tmp
                                  if (k <= 3.5d-307) then
                                      tmp = a / (k * k)
                                  else if (k <= 6d+21) then
                                      tmp = a / 1.0d0
                                  else
                                      tmp = (a / k) / k
                                  end if
                                  code = tmp
                              end function
                              
                              public static double code(double a, double k, double m) {
                              	double tmp;
                              	if (k <= 3.5e-307) {
                              		tmp = a / (k * k);
                              	} else if (k <= 6e+21) {
                              		tmp = a / 1.0;
                              	} else {
                              		tmp = (a / k) / k;
                              	}
                              	return tmp;
                              }
                              
                              def code(a, k, m):
                              	tmp = 0
                              	if k <= 3.5e-307:
                              		tmp = a / (k * k)
                              	elif k <= 6e+21:
                              		tmp = a / 1.0
                              	else:
                              		tmp = (a / k) / k
                              	return tmp
                              
                              function code(a, k, m)
                              	tmp = 0.0
                              	if (k <= 3.5e-307)
                              		tmp = Float64(a / Float64(k * k));
                              	elseif (k <= 6e+21)
                              		tmp = Float64(a / 1.0);
                              	else
                              		tmp = Float64(Float64(a / k) / k);
                              	end
                              	return tmp
                              end
                              
                              function tmp_2 = code(a, k, m)
                              	tmp = 0.0;
                              	if (k <= 3.5e-307)
                              		tmp = a / (k * k);
                              	elseif (k <= 6e+21)
                              		tmp = a / 1.0;
                              	else
                              		tmp = (a / k) / k;
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              code[a_, k_, m_] := If[LessEqual[k, 3.5e-307], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 6e+21], N[(a / 1.0), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\
                              \;\;\;\;\frac{a}{k \cdot k}\\
                              
                              \mathbf{elif}\;k \leq 6 \cdot 10^{+21}:\\
                              \;\;\;\;\frac{a}{1}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\frac{\frac{a}{k}}{k}\\
                              
                              
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if k < 3.5000000000000002e-307

                                1. Initial program 90.6%

                                  \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                2. Taylor expanded in m around 0

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

                                    \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                  2. lower-+.f64N/A

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

                                    \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                  4. lower-pow.f6444.3%

                                    \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                                4. Applied rewrites44.3%

                                  \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                                5. Taylor expanded in k around inf

                                  \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                6. Step-by-step derivation
                                  1. lower-/.f64N/A

                                    \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                  2. lower-pow.f6435.8%

                                    \[\leadsto \frac{a}{{k}^{2}} \]
                                7. Applied rewrites35.8%

                                  \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                8. Step-by-step derivation
                                  1. lift-pow.f64N/A

                                    \[\leadsto \frac{a}{{k}^{2}} \]
                                  2. pow2N/A

                                    \[\leadsto \frac{a}{k \cdot k} \]
                                  3. lift-*.f6435.8%

                                    \[\leadsto \frac{a}{k \cdot k} \]
                                9. Applied rewrites35.8%

                                  \[\leadsto \frac{a}{k \cdot k} \]

                                if 3.5000000000000002e-307 < k < 6e21

                                1. Initial program 90.6%

                                  \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                2. Taylor expanded in m around 0

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

                                    \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                  2. lower-+.f64N/A

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

                                    \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                  4. lower-pow.f6444.3%

                                    \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                                4. Applied rewrites44.3%

                                  \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                                5. Taylor expanded in k around 0

                                  \[\leadsto \frac{a}{1} \]
                                6. Step-by-step derivation
                                  1. Applied rewrites19.8%

                                    \[\leadsto \frac{a}{1} \]

                                  if 6e21 < k

                                  1. Initial program 90.6%

                                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                  2. Taylor expanded in m around 0

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

                                      \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                    2. lower-+.f64N/A

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

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                    4. lower-pow.f6444.3%

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                                  4. Applied rewrites44.3%

                                    \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                                  5. Taylor expanded in k around inf

                                    \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                  6. Step-by-step derivation
                                    1. lower-/.f64N/A

                                      \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                    2. lower-pow.f6435.8%

                                      \[\leadsto \frac{a}{{k}^{2}} \]
                                  7. Applied rewrites35.8%

                                    \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                  8. Step-by-step derivation
                                    1. lift-/.f64N/A

                                      \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                    2. lift-pow.f64N/A

                                      \[\leadsto \frac{a}{{k}^{2}} \]
                                    3. pow2N/A

                                      \[\leadsto \frac{a}{k \cdot k} \]
                                    4. associate-/r*N/A

                                      \[\leadsto \frac{\frac{a}{k}}{k} \]
                                    5. lower-/.f64N/A

                                      \[\leadsto \frac{\frac{a}{k}}{k} \]
                                    6. lower-/.f6434.3%

                                      \[\leadsto \frac{\frac{a}{k}}{k} \]
                                  9. Applied rewrites34.3%

                                    \[\leadsto \frac{\frac{a}{k}}{k} \]
                                7. Recombined 3 regimes into one program.
                                8. Add Preprocessing

                                Alternative 13: 45.4% accurate, 2.3× speedup?

                                \[\begin{array}{l} t_0 := \frac{a}{k \cdot k}\\ \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;k \leq 6 \cdot 10^{+21}:\\ \;\;\;\;\frac{a}{1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                                (FPCore (a k m)
                                 :precision binary64
                                 (let* ((t_0 (/ a (* k k))))
                                   (if (<= k 3.5e-307) t_0 (if (<= k 6e+21) (/ a 1.0) t_0))))
                                double code(double a, double k, double m) {
                                	double t_0 = a / (k * k);
                                	double tmp;
                                	if (k <= 3.5e-307) {
                                		tmp = t_0;
                                	} else if (k <= 6e+21) {
                                		tmp = a / 1.0;
                                	} else {
                                		tmp = t_0;
                                	}
                                	return tmp;
                                }
                                
                                module fmin_fmax_functions
                                    implicit none
                                    private
                                    public fmax
                                    public fmin
                                
                                    interface fmax
                                        module procedure fmax88
                                        module procedure fmax44
                                        module procedure fmax84
                                        module procedure fmax48
                                    end interface
                                    interface fmin
                                        module procedure fmin88
                                        module procedure fmin44
                                        module procedure fmin84
                                        module procedure fmin48
                                    end interface
                                contains
                                    real(8) function fmax88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmax44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmax84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmax48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmin44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmin48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                    end function
                                end module
                                
                                real(8) function code(a, k, m)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: a
                                    real(8), intent (in) :: k
                                    real(8), intent (in) :: m
                                    real(8) :: t_0
                                    real(8) :: tmp
                                    t_0 = a / (k * k)
                                    if (k <= 3.5d-307) then
                                        tmp = t_0
                                    else if (k <= 6d+21) then
                                        tmp = a / 1.0d0
                                    else
                                        tmp = t_0
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double a, double k, double m) {
                                	double t_0 = a / (k * k);
                                	double tmp;
                                	if (k <= 3.5e-307) {
                                		tmp = t_0;
                                	} else if (k <= 6e+21) {
                                		tmp = a / 1.0;
                                	} else {
                                		tmp = t_0;
                                	}
                                	return tmp;
                                }
                                
                                def code(a, k, m):
                                	t_0 = a / (k * k)
                                	tmp = 0
                                	if k <= 3.5e-307:
                                		tmp = t_0
                                	elif k <= 6e+21:
                                		tmp = a / 1.0
                                	else:
                                		tmp = t_0
                                	return tmp
                                
                                function code(a, k, m)
                                	t_0 = Float64(a / Float64(k * k))
                                	tmp = 0.0
                                	if (k <= 3.5e-307)
                                		tmp = t_0;
                                	elseif (k <= 6e+21)
                                		tmp = Float64(a / 1.0);
                                	else
                                		tmp = t_0;
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(a, k, m)
                                	t_0 = a / (k * k);
                                	tmp = 0.0;
                                	if (k <= 3.5e-307)
                                		tmp = t_0;
                                	elseif (k <= 6e+21)
                                		tmp = a / 1.0;
                                	else
                                		tmp = t_0;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 3.5e-307], t$95$0, If[LessEqual[k, 6e+21], N[(a / 1.0), $MachinePrecision], t$95$0]]]
                                
                                \begin{array}{l}
                                t_0 := \frac{a}{k \cdot k}\\
                                \mathbf{if}\;k \leq 3.5 \cdot 10^{-307}:\\
                                \;\;\;\;t\_0\\
                                
                                \mathbf{elif}\;k \leq 6 \cdot 10^{+21}:\\
                                \;\;\;\;\frac{a}{1}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_0\\
                                
                                
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if k < 3.5000000000000002e-307 or 6e21 < k

                                  1. Initial program 90.6%

                                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                  2. Taylor expanded in m around 0

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

                                      \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                    2. lower-+.f64N/A

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

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                    4. lower-pow.f6444.3%

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                                  4. Applied rewrites44.3%

                                    \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                                  5. Taylor expanded in k around inf

                                    \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                  6. Step-by-step derivation
                                    1. lower-/.f64N/A

                                      \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                    2. lower-pow.f6435.8%

                                      \[\leadsto \frac{a}{{k}^{2}} \]
                                  7. Applied rewrites35.8%

                                    \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                                  8. Step-by-step derivation
                                    1. lift-pow.f64N/A

                                      \[\leadsto \frac{a}{{k}^{2}} \]
                                    2. pow2N/A

                                      \[\leadsto \frac{a}{k \cdot k} \]
                                    3. lift-*.f6435.8%

                                      \[\leadsto \frac{a}{k \cdot k} \]
                                  9. Applied rewrites35.8%

                                    \[\leadsto \frac{a}{k \cdot k} \]

                                  if 3.5000000000000002e-307 < k < 6e21

                                  1. Initial program 90.6%

                                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                  2. Taylor expanded in m around 0

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

                                      \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                    2. lower-+.f64N/A

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

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                    4. lower-pow.f6444.3%

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                                  4. Applied rewrites44.3%

                                    \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                                  5. Taylor expanded in k around 0

                                    \[\leadsto \frac{a}{1} \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites19.8%

                                      \[\leadsto \frac{a}{1} \]
                                  7. Recombined 2 regimes into one program.
                                  8. Add Preprocessing

                                  Alternative 14: 19.8% accurate, 7.5× speedup?

                                  \[\frac{a}{1} \]
                                  (FPCore (a k m) :precision binary64 (/ a 1.0))
                                  double code(double a, double k, double m) {
                                  	return a / 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(a, k, m)
                                  use fmin_fmax_functions
                                      real(8), intent (in) :: a
                                      real(8), intent (in) :: k
                                      real(8), intent (in) :: m
                                      code = a / 1.0d0
                                  end function
                                  
                                  public static double code(double a, double k, double m) {
                                  	return a / 1.0;
                                  }
                                  
                                  def code(a, k, m):
                                  	return a / 1.0
                                  
                                  function code(a, k, m)
                                  	return Float64(a / 1.0)
                                  end
                                  
                                  function tmp = code(a, k, m)
                                  	tmp = a / 1.0;
                                  end
                                  
                                  code[a_, k_, m_] := N[(a / 1.0), $MachinePrecision]
                                  
                                  \frac{a}{1}
                                  
                                  Derivation
                                  1. Initial program 90.6%

                                    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
                                  2. Taylor expanded in m around 0

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

                                      \[\leadsto \frac{a}{\color{blue}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
                                    2. lower-+.f64N/A

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

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, \color{blue}{k}, {k}^{2}\right)} \]
                                    4. lower-pow.f6444.3%

                                      \[\leadsto \frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)} \]
                                  4. Applied rewrites44.3%

                                    \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
                                  5. Taylor expanded in k around 0

                                    \[\leadsto \frac{a}{1} \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites19.8%

                                      \[\leadsto \frac{a}{1} \]
                                    2. Add Preprocessing

                                    Reproduce

                                    ?
                                    herbie shell --seed 2025207 
                                    (FPCore (a k m)
                                      :name "Falkner and Boettcher, Appendix A"
                                      :precision binary64
                                      (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))