Falkner and Boettcher, Appendix A

Percentage Accurate: 90.4% → 97.4%
Time: 9.0s
Alternatives: 11
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \end{array} \]
(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]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 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.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \end{array} \]
(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]
\begin{array}{l}

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

Alternative 1: 97.4% accurate, 1.0× speedup?

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

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

real(8) function code(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 (m <= 2.65d-14) then
        tmp = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
    else
        tmp = (k ** m) * a
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= 2.65e-14) {
		tmp = (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
	} else {
		tmp = Math.pow(k, m) * a;
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= 2.65e-14:
		tmp = (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
	else:
		tmp = math.pow(k, m) * a
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= 2.65e-14)
		tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)));
	else
		tmp = Float64((k ^ m) * a);
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= 2.65e-14)
		tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
	else
		tmp = (k ^ m) * a;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, 2.65e-14], 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], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.65 \cdot 10^{-14}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\

\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < 2.6500000000000001e-14

    1. Initial program 97.9%

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

    if 2.6500000000000001e-14 < m

    1. Initial program 63.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
      7. lower-+.f643.4

        \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
    5. Applied rewrites3.4%

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

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

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

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
      3. lower-pow.f6498.8

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

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

Alternative 2: 46.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{k \cdot k}\\ t_1 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-309}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+294}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(99, k, -10\right) \cdot a, k, a\right)\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (/ a (* k k)))
        (t_1 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
   (if (<= t_1 5e-309)
     t_0
     (if (<= t_1 2e+294)
       (fma (* (fma 99.0 k -10.0) a) k a)
       (if (<= t_1 INFINITY) t_0 (* (* (* k a) k) 99.0))))))
double code(double a, double k, double m) {
	double t_0 = a / (k * k);
	double t_1 = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
	double tmp;
	if (t_1 <= 5e-309) {
		tmp = t_0;
	} else if (t_1 <= 2e+294) {
		tmp = fma((fma(99.0, k, -10.0) * a), k, a);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_0;
	} else {
		tmp = ((k * a) * k) * 99.0;
	}
	return tmp;
}
function code(a, k, m)
	t_0 = Float64(a / Float64(k * k))
	t_1 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
	tmp = 0.0
	if (t_1 <= 5e-309)
		tmp = t_0;
	elseif (t_1 <= 2e+294)
		tmp = fma(Float64(fma(99.0, k, -10.0) * a), k, a);
	elseif (t_1 <= Inf)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(k * a) * k) * 99.0);
	end
	return tmp
end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 5e-309], t$95$0, If[LessEqual[t$95$1, 2e+294], N[(N[(N[(99.0 * k + -10.0), $MachinePrecision] * a), $MachinePrecision] * k + a), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$0, N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
t_1 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-309}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+294}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(99, k, -10\right) \cdot a, k, a\right)\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 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))) < 4.9999999999999995e-309 or 2.00000000000000013e294 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < +inf.0

    1. Initial program 97.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
      7. lower-+.f6448.3

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

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

      \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
    7. Step-by-step derivation
      1. Applied rewrites47.0%

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

      if 4.9999999999999995e-309 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 2.00000000000000013e294

      1. Initial program 100.0%

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

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

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

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

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

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

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

          \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
        7. lower-+.f6498.4

          \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
      5. Applied rewrites98.4%

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

        \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites73.9%

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

          \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
        3. Step-by-step derivation
          1. Applied rewrites74.6%

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

          if +inf.0 < (/.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 0.0%

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

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

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

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

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

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

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

              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
            7. lower-+.f641.6

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

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

            \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
          7. Step-by-step derivation
            1. Applied rewrites93.1%

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(99 \cdot a, k, -10 \cdot a\right), \color{blue}{k}, a\right) \]
            2. Taylor expanded in k around inf

              \[\leadsto 99 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
            3. Step-by-step derivation
              1. Applied rewrites93.1%

                \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 99 \]
            4. Recombined 3 regimes into one program.
            5. Add Preprocessing

            Alternative 3: 46.3% accurate, 0.3× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{k \cdot k}\\ t_1 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-309}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+294}:\\ \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\ \end{array} \end{array} \]
            (FPCore (a k m)
             :precision binary64
             (let* ((t_0 (/ a (* k k)))
                    (t_1 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
               (if (<= t_1 5e-309)
                 t_0
                 (if (<= t_1 2e+294)
                   (* (fma -10.0 k 1.0) a)
                   (if (<= t_1 INFINITY) t_0 (* (* (* k a) k) 99.0))))))
            double code(double a, double k, double m) {
            	double t_0 = a / (k * k);
            	double t_1 = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
            	double tmp;
            	if (t_1 <= 5e-309) {
            		tmp = t_0;
            	} else if (t_1 <= 2e+294) {
            		tmp = fma(-10.0, k, 1.0) * a;
            	} else if (t_1 <= ((double) INFINITY)) {
            		tmp = t_0;
            	} else {
            		tmp = ((k * a) * k) * 99.0;
            	}
            	return tmp;
            }
            
            function code(a, k, m)
            	t_0 = Float64(a / Float64(k * k))
            	t_1 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
            	tmp = 0.0
            	if (t_1 <= 5e-309)
            		tmp = t_0;
            	elseif (t_1 <= 2e+294)
            		tmp = Float64(fma(-10.0, k, 1.0) * a);
            	elseif (t_1 <= Inf)
            		tmp = t_0;
            	else
            		tmp = Float64(Float64(Float64(k * a) * k) * 99.0);
            	end
            	return tmp
            end
            
            code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, 5e-309], t$95$0, If[LessEqual[t$95$1, 2e+294], N[(N[(-10.0 * k + 1.0), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$0, N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \frac{a}{k \cdot k}\\
            t_1 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
            \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-309}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+294}:\\
            \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\
            
            \mathbf{elif}\;t\_1 \leq \infty:\\
            \;\;\;\;t\_0\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 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))) < 4.9999999999999995e-309 or 2.00000000000000013e294 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < +inf.0

              1. Initial program 97.6%

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

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

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

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

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

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

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

                  \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                7. lower-+.f6448.3

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

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

                \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
              7. Step-by-step derivation
                1. Applied rewrites47.0%

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

                if 4.9999999999999995e-309 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 2.00000000000000013e294

                1. Initial program 100.0%

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

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

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

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

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

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

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

                    \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                  7. lower-+.f6498.4

                    \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                5. Applied rewrites98.4%

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

                  \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                7. Step-by-step derivation
                  1. Applied rewrites73.9%

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

                  if +inf.0 < (/.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 0.0%

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

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

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

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

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

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

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

                      \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                    7. lower-+.f641.6

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

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

                    \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
                  7. Step-by-step derivation
                    1. Applied rewrites93.1%

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(99 \cdot a, k, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                    2. Taylor expanded in k around inf

                      \[\leadsto 99 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites93.1%

                        \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 99 \]
                    4. Recombined 3 regimes into one program.
                    5. Add Preprocessing

                    Alternative 4: 96.9% accurate, 1.1× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.72 \lor \neg \left(m \leq 2.65 \cdot 10^{-14}\right):\\ \;\;\;\;{k}^{m} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \end{array} \end{array} \]
                    (FPCore (a k m)
                     :precision binary64
                     (if (or (<= m -0.72) (not (<= m 2.65e-14)))
                       (* (pow k m) a)
                       (/ a (fma (+ 10.0 k) k 1.0))))
                    double code(double a, double k, double m) {
                    	double tmp;
                    	if ((m <= -0.72) || !(m <= 2.65e-14)) {
                    		tmp = pow(k, m) * a;
                    	} else {
                    		tmp = a / fma((10.0 + k), k, 1.0);
                    	}
                    	return tmp;
                    }
                    
                    function code(a, k, m)
                    	tmp = 0.0
                    	if ((m <= -0.72) || !(m <= 2.65e-14))
                    		tmp = Float64((k ^ m) * a);
                    	else
                    		tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0));
                    	end
                    	return tmp
                    end
                    
                    code[a_, k_, m_] := If[Or[LessEqual[m, -0.72], N[Not[LessEqual[m, 2.65e-14]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;m \leq -0.72 \lor \neg \left(m \leq 2.65 \cdot 10^{-14}\right):\\
                    \;\;\;\;{k}^{m} \cdot a\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if m < -0.71999999999999997 or 2.6500000000000001e-14 < m

                      1. Initial program 83.2%

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

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

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

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

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

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

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

                          \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                        7. lower-+.f6423.5

                          \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                      5. Applied rewrites23.5%

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

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

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

                          \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
                        2. lower-*.f64N/A

                          \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
                        3. lower-pow.f6499.4

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

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

                      if -0.71999999999999997 < m < 2.6500000000000001e-14

                      1. Initial program 95.7%

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

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

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

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

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

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

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

                          \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                        7. lower-+.f6495.5

                          \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                      5. Applied rewrites95.5%

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -0.72 \lor \neg \left(m \leq 2.65 \cdot 10^{-14}\right):\\ \;\;\;\;{k}^{m} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \end{array} \]
                    5. Add Preprocessing

                    Alternative 5: 70.4% accurate, 2.3× speedup?

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

                      1. Initial program 100.0%

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

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

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

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

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

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

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

                          \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                        7. lower-+.f6440.9

                          \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                      5. Applied rewrites40.9%

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

                        \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                      7. Step-by-step derivation
                        1. Applied rewrites3.2%

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

                          \[\leadsto \frac{\left(a + -1 \cdot \frac{a + -100 \cdot a}{{k}^{2}}\right) - 10 \cdot \frac{a}{k}}{\color{blue}{{k}^{2}}} \]
                        3. Step-by-step derivation
                          1. Applied rewrites74.6%

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

                          if -0.92000000000000004 < m < 0.97999999999999998

                          1. Initial program 95.8%

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

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

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

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

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

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

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

                              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                            7. lower-+.f6495.3

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

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

                          if 0.97999999999999998 < m

                          1. Initial program 63.2%

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

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

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

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

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

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

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

                              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                            7. lower-+.f642.5

                              \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                          5. Applied rewrites2.5%

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

                            \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
                          7. Step-by-step derivation
                            1. Applied rewrites41.8%

                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(99 \cdot a, k, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                            2. Taylor expanded in k around inf

                              \[\leadsto 99 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                            3. Step-by-step derivation
                              1. Applied rewrites56.5%

                                \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 99 \]
                            4. Recombined 3 regimes into one program.
                            5. Add Preprocessing

                            Alternative 6: 68.5% accurate, 4.1× speedup?

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

                              1. Initial program 100.0%

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

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

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

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

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

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

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

                                  \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                7. lower-+.f6440.9

                                  \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                              5. Applied rewrites40.9%

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

                                \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                              7. Step-by-step derivation
                                1. Applied rewrites66.0%

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

                                if -0.92000000000000004 < m < 0.97999999999999998

                                1. Initial program 95.8%

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

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

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

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

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

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

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

                                    \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                  7. lower-+.f6495.3

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

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

                                if 0.97999999999999998 < m

                                1. Initial program 63.2%

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

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

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

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

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

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

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

                                    \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                  7. lower-+.f642.5

                                    \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                5. Applied rewrites2.5%

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

                                  \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites41.8%

                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(99 \cdot a, k, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                                  2. Taylor expanded in k around inf

                                    \[\leadsto 99 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites56.5%

                                      \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 99 \]
                                  4. Recombined 3 regimes into one program.
                                  5. Add Preprocessing

                                  Alternative 7: 67.6% accurate, 4.1× speedup?

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

                                    1. Initial program 100.0%

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

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

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

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

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

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

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

                                        \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                      7. lower-+.f6440.9

                                        \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                    5. Applied rewrites40.9%

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

                                      \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites66.0%

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

                                      if -0.92000000000000004 < m < 0.97999999999999998

                                      1. Initial program 95.8%

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

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

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

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

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

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

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

                                          \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                        7. lower-+.f6495.3

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

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

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

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

                                        if 0.97999999999999998 < m

                                        1. Initial program 63.2%

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

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

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

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

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

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

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

                                            \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                          7. lower-+.f642.5

                                            \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                        5. Applied rewrites2.5%

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

                                          \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites41.8%

                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(99 \cdot a, k, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                                          2. Taylor expanded in k around inf

                                            \[\leadsto 99 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites56.5%

                                              \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 99 \]
                                          4. Recombined 3 regimes into one program.
                                          5. Add Preprocessing

                                          Alternative 8: 58.5% accurate, 4.5× speedup?

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

                                            1. Initial program 100.0%

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

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

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

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

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

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

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

                                                \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                              7. lower-+.f6441.6

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

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

                                              \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites66.4%

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

                                              if -0.00116 < m < 0.47999999999999998

                                              1. Initial program 95.7%

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

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

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

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

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

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

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

                                                  \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                7. lower-+.f6495.2

                                                  \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                              5. Applied rewrites95.2%

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

                                                \[\leadsto \frac{a}{\mathsf{fma}\left(10, k, 1\right)} \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites70.8%

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

                                                if 0.47999999999999998 < m

                                                1. Initial program 63.2%

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

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

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

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

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

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

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

                                                    \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                  7. lower-+.f642.5

                                                    \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                5. Applied rewrites2.5%

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

                                                  \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites41.8%

                                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(99 \cdot a, k, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                                                  2. Taylor expanded in k around inf

                                                    \[\leadsto 99 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites56.5%

                                                      \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 99 \]
                                                  4. Recombined 3 regimes into one program.
                                                  5. Add Preprocessing

                                                  Alternative 9: 36.3% accurate, 6.1× speedup?

                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 0.112:\\ \;\;\;\;\frac{a}{1}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\ \end{array} \end{array} \]
                                                  (FPCore (a k m)
                                                   :precision binary64
                                                   (if (<= m 0.112) (/ a 1.0) (* (* (* k a) k) 99.0)))
                                                  double code(double a, double k, double m) {
                                                  	double tmp;
                                                  	if (m <= 0.112) {
                                                  		tmp = a / 1.0;
                                                  	} else {
                                                  		tmp = ((k * a) * k) * 99.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) :: tmp
                                                      if (m <= 0.112d0) then
                                                          tmp = a / 1.0d0
                                                      else
                                                          tmp = ((k * a) * k) * 99.0d0
                                                      end if
                                                      code = tmp
                                                  end function
                                                  
                                                  public static double code(double a, double k, double m) {
                                                  	double tmp;
                                                  	if (m <= 0.112) {
                                                  		tmp = a / 1.0;
                                                  	} else {
                                                  		tmp = ((k * a) * k) * 99.0;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  def code(a, k, m):
                                                  	tmp = 0
                                                  	if m <= 0.112:
                                                  		tmp = a / 1.0
                                                  	else:
                                                  		tmp = ((k * a) * k) * 99.0
                                                  	return tmp
                                                  
                                                  function code(a, k, m)
                                                  	tmp = 0.0
                                                  	if (m <= 0.112)
                                                  		tmp = Float64(a / 1.0);
                                                  	else
                                                  		tmp = Float64(Float64(Float64(k * a) * k) * 99.0);
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  function tmp_2 = code(a, k, m)
                                                  	tmp = 0.0;
                                                  	if (m <= 0.112)
                                                  		tmp = a / 1.0;
                                                  	else
                                                  		tmp = ((k * a) * k) * 99.0;
                                                  	end
                                                  	tmp_2 = tmp;
                                                  end
                                                  
                                                  code[a_, k_, m_] := If[LessEqual[m, 0.112], N[(a / 1.0), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]
                                                  
                                                  \begin{array}{l}
                                                  
                                                  \\
                                                  \begin{array}{l}
                                                  \mathbf{if}\;m \leq 0.112:\\
                                                  \;\;\;\;\frac{a}{1}\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 2 regimes
                                                  2. if m < 0.112000000000000002

                                                    1. Initial program 97.9%

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

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

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

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

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

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

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

                                                        \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                      7. lower-+.f6468.4

                                                        \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                    5. Applied rewrites68.4%

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

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

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

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

                                                      if 0.112000000000000002 < m

                                                      1. Initial program 63.2%

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

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

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

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

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

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

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

                                                          \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                        7. lower-+.f642.5

                                                          \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                      5. Applied rewrites2.5%

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

                                                        \[\leadsto a + \color{blue}{k \cdot \left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a\right)} \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites41.8%

                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(99 \cdot a, k, -10 \cdot a\right), \color{blue}{k}, a\right) \]
                                                        2. Taylor expanded in k around inf

                                                          \[\leadsto 99 \cdot \left(a \cdot \color{blue}{{k}^{2}}\right) \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites56.5%

                                                            \[\leadsto \left(\left(k \cdot a\right) \cdot k\right) \cdot 99 \]
                                                        4. Recombined 2 regimes into one program.
                                                        5. Add Preprocessing

                                                        Alternative 10: 25.5% accurate, 7.4× speedup?

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

                                                          1. Initial program 80.0%

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

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

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

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

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

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

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

                                                              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                            7. lower-+.f6424.1

                                                              \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                          5. Applied rewrites24.1%

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

                                                            \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                                                          7. Step-by-step derivation
                                                            1. Applied rewrites16.4%

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

                                                              \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites19.4%

                                                                \[\leadsto \left(-10 \cdot a\right) \cdot k \]

                                                              if -1.18e-296 < k

                                                              1. Initial program 89.9%

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

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

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

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

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

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

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

                                                                  \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                                7. lower-+.f6456.4

                                                                  \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                              5. Applied rewrites56.4%

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

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

                                                                \[\leadsto a + \color{blue}{10 \cdot \left(a \cdot k\right)} \]
                                                              8. Step-by-step derivation
                                                                1. Applied rewrites29.7%

                                                                  \[\leadsto \mathsf{fma}\left(a \cdot k, \color{blue}{10}, a\right) \]
                                                              9. Recombined 2 regimes into one program.
                                                              10. Add Preprocessing

                                                              Alternative 11: 7.6% accurate, 12.2× speedup?

                                                              \[\begin{array}{l} \\ \left(-10 \cdot a\right) \cdot k \end{array} \]
                                                              (FPCore (a k m) :precision binary64 (* (* -10.0 a) k))
                                                              double code(double a, double k, double m) {
                                                              	return (-10.0 * a) * 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 = ((-10.0d0) * a) * k
                                                              end function
                                                              
                                                              public static double code(double a, double k, double m) {
                                                              	return (-10.0 * a) * k;
                                                              }
                                                              
                                                              def code(a, k, m):
                                                              	return (-10.0 * a) * k
                                                              
                                                              function code(a, k, m)
                                                              	return Float64(Float64(-10.0 * a) * k)
                                                              end
                                                              
                                                              function tmp = code(a, k, m)
                                                              	tmp = (-10.0 * a) * k;
                                                              end
                                                              
                                                              code[a_, k_, m_] := N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \left(-10 \cdot a\right) \cdot k
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Initial program 87.6%

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

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

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

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

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

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

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

                                                                  \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(10 + k, k, 1\right)}} \]
                                                                7. lower-+.f6448.9

                                                                  \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                              5. Applied rewrites48.9%

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

                                                                \[\leadsto a + \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
                                                              7. Step-by-step derivation
                                                                1. Applied rewrites23.4%

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

                                                                  \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites8.1%

                                                                    \[\leadsto \left(-10 \cdot a\right) \cdot k \]
                                                                  2. Add Preprocessing

                                                                  Reproduce

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