Falkner and Boettcher, Appendix A

Percentage Accurate: 90.4% → 97.9%
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.9% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(99 \cdot k - 10\right) \cdot k, a, a\right)\\


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

    1. Initial program 97.3%

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

    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 k around 0

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot \left(k \cdot \left(-100 \cdot \left(a \cdot {k}^{m}\right) + a \cdot {k}^{m}\right)\right) - 10 \cdot \left(a \cdot {k}^{m}\right), k, a \cdot {k}^{m}\right)} \]
    5. Applied rewrites100.0%

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

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

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

    Alternative 2: 16.9% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 0:\\ \;\;\;\;\left(-10 \cdot a\right) \cdot k\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(10, k, 1\right) \cdot a\\ \end{array} \end{array} \]
    (FPCore (a k m)
     :precision binary64
     (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 0.0)
       (* (* -10.0 a) k)
       (* (fma 10.0 k 1.0) a)))
    double code(double a, double k, double m) {
    	double tmp;
    	if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 0.0) {
    		tmp = (-10.0 * a) * k;
    	} else {
    		tmp = fma(10.0, k, 1.0) * a;
    	}
    	return tmp;
    }
    
    function code(a, k, m)
    	tmp = 0.0
    	if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 0.0)
    		tmp = Float64(Float64(-10.0 * a) * k);
    	else
    		tmp = Float64(fma(10.0, k, 1.0) * a);
    	end
    	return tmp
    end
    
    code[a_, k_, m_] := If[LessEqual[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], 0.0], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision], N[(N[(10.0 * k + 1.0), $MachinePrecision] * a), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 0:\\
    \;\;\;\;\left(-10 \cdot a\right) \cdot k\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(10, k, 1\right) \cdot a\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 0.0

      1. Initial program 96.5%

        \[\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-+.f6445.7

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

        \[\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 rewrites13.7%

          \[\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.7%

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

          if 0.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 71.0%

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

            \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
          4. Step-by-step derivation
            1. remove-double-negN/A

              \[\leadsto -10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a\right)\right)\right)\right)} \cdot {k}^{m} \]
            2. fp-cancel-sub-sign-invN/A

              \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) - \left(\mathsf{neg}\left(a\right)\right) \cdot {k}^{m}} \]
            3. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

              \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(10\right)\right)} \cdot k\right) \cdot \left(a \cdot {k}^{m}\right) + a \cdot {k}^{m} \]
            11. distribute-lft1-inN/A

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(-10, k, 1\right)} \cdot \left(a \cdot {k}^{m}\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
            16. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
            17. lower-pow.f6473.4

              \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \left(\color{blue}{{k}^{m}} \cdot a\right) \]
          5. Applied rewrites73.4%

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

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

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

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

            Alternative 3: 97.2% accurate, 1.1× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -3.7 \cdot 10^{-6} \lor \neg \left(m \leq 0.0011\right):\\ \;\;\;\;1 \cdot \left({k}^{m} \cdot a\right)\\ \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 -3.7e-6) (not (<= m 0.0011)))
               (* 1.0 (* (pow k m) a))
               (/ a (fma (+ 10.0 k) k 1.0))))
            double code(double a, double k, double m) {
            	double tmp;
            	if ((m <= -3.7e-6) || !(m <= 0.0011)) {
            		tmp = 1.0 * (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 <= -3.7e-6) || !(m <= 0.0011))
            		tmp = Float64(1.0 * 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, -3.7e-6], N[Not[LessEqual[m, 0.0011]], $MachinePrecision]], N[(1.0 * N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;m \leq -3.7 \cdot 10^{-6} \lor \neg \left(m \leq 0.0011\right):\\
            \;\;\;\;1 \cdot \left({k}^{m} \cdot a\right)\\
            
            \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 < -3.7000000000000002e-6 or 0.00110000000000000007 < m

              1. Initial program 86.9%

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

                \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
              4. Step-by-step derivation
                1. remove-double-negN/A

                  \[\leadsto -10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a\right)\right)\right)\right)} \cdot {k}^{m} \]
                2. fp-cancel-sub-sign-invN/A

                  \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) - \left(\mathsf{neg}\left(a\right)\right) \cdot {k}^{m}} \]
                3. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                  \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(10\right)\right)} \cdot k\right) \cdot \left(a \cdot {k}^{m}\right) + a \cdot {k}^{m} \]
                11. distribute-lft1-inN/A

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

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

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(-10, k, 1\right)} \cdot \left(a \cdot {k}^{m}\right) \]
                15. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
                16. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
                17. lower-pow.f6482.7

                  \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \left(\color{blue}{{k}^{m}} \cdot a\right) \]
              5. Applied rewrites82.7%

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

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

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

                    \[\leadsto 1 \cdot \left(\color{blue}{{k}^{m}} \cdot a\right) \]

                  if -3.7000000000000002e-6 < m < 0.00110000000000000007

                  1. Initial program 92.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-+.f6492.8

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

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

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

                Alternative 4: 97.1% accurate, 1.1× speedup?

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

                  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 k around 0

                    \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
                  4. Step-by-step derivation
                    1. remove-double-negN/A

                      \[\leadsto -10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a\right)\right)\right)\right)} \cdot {k}^{m} \]
                    2. fp-cancel-sub-sign-invN/A

                      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) - \left(\mathsf{neg}\left(a\right)\right) \cdot {k}^{m}} \]
                    3. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                      \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(10\right)\right)} \cdot k\right) \cdot \left(a \cdot {k}^{m}\right) + a \cdot {k}^{m} \]
                    11. distribute-lft1-inN/A

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(-10, k, 1\right)} \cdot \left(a \cdot {k}^{m}\right) \]
                    15. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
                    16. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
                    17. lower-pow.f6498.6

                      \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \left(\color{blue}{{k}^{m}} \cdot a\right) \]
                  5. Applied rewrites98.6%

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

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

                    if -7.7999999999999999e-5 < m < 0.00110000000000000007

                    1. Initial program 92.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-+.f6492.8

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

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

                    if 0.00110000000000000007 < m

                    1. Initial program 77.6%

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

                      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
                    4. Step-by-step derivation
                      1. remove-double-negN/A

                        \[\leadsto -10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a\right)\right)\right)\right)} \cdot {k}^{m} \]
                      2. fp-cancel-sub-sign-invN/A

                        \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) - \left(\mathsf{neg}\left(a\right)\right) \cdot {k}^{m}} \]
                      3. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(10\right)\right)} \cdot k\right) \cdot \left(a \cdot {k}^{m}\right) + a \cdot {k}^{m} \]
                      11. distribute-lft1-inN/A

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(-10, k, 1\right)} \cdot \left(a \cdot {k}^{m}\right) \]
                      15. *-commutativeN/A

                        \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
                      16. lower-*.f64N/A

                        \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \color{blue}{\left({k}^{m} \cdot a\right)} \]
                      17. lower-pow.f6471.4

                        \[\leadsto \mathsf{fma}\left(-10, k, 1\right) \cdot \left(\color{blue}{{k}^{m}} \cdot a\right) \]
                    5. Applied rewrites71.4%

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

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

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

                          \[\leadsto 1 \cdot \left(\color{blue}{{k}^{m}} \cdot a\right) \]
                      4. Recombined 3 regimes into one program.
                      5. Add Preprocessing

                      Alternative 5: 69.9% accurate, 2.3× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -8000000000000:\\ \;\;\;\;\frac{a - \frac{\mathsf{fma}\left(-99, \frac{a}{k}, 10 \cdot a\right)}{k}}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.9:\\ \;\;\;\;\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 -8000000000000.0)
                         (/ (- a (/ (fma -99.0 (/ a k) (* 10.0 a)) k)) (* k k))
                         (if (<= m 0.9) (/ 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 <= -8000000000000.0) {
                      		tmp = (a - (fma(-99.0, (a / k), (10.0 * a)) / k)) / (k * k);
                      	} else if (m <= 0.9) {
                      		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 <= -8000000000000.0)
                      		tmp = Float64(Float64(a - Float64(fma(-99.0, Float64(a / k), Float64(10.0 * a)) / k)) / Float64(k * k));
                      	elseif (m <= 0.9)
                      		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, -8000000000000.0], N[(N[(a - N[(N[(-99.0 * N[(a / k), $MachinePrecision] + N[(10.0 * a), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.9], 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 -8000000000000:\\
                      \;\;\;\;\frac{a - \frac{\mathsf{fma}\left(-99, \frac{a}{k}, 10 \cdot a\right)}{k}}{k \cdot k}\\
                      
                      \mathbf{elif}\;m \leq 0.9:\\
                      \;\;\;\;\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 < -8e12

                        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-+.f6433.2

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

                          \[\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.0%

                            \[\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 rewrites2.2%

                              \[\leadsto \left(-10 \cdot a\right) \cdot k \]
                            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 rewrites59.7%

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

                              if -8e12 < m < 0.900000000000000022

                              1. Initial program 92.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-+.f6491.8

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

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

                              if 0.900000000000000022 < m

                              1. Initial program 77.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-+.f643.0

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

                                \[\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 rewrites26.7%

                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(k \cdot a\right)\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 rewrites45.7%

                                    \[\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.2% accurate, 4.1× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -8000000000000:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.9:\\ \;\;\;\;\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 -8000000000000.0)
                                   (/ a (* k k))
                                   (if (<= m 0.9) (/ 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 <= -8000000000000.0) {
                                		tmp = a / (k * k);
                                	} else if (m <= 0.9) {
                                		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 <= -8000000000000.0)
                                		tmp = Float64(a / Float64(k * k));
                                	elseif (m <= 0.9)
                                		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, -8000000000000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.9], 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 -8000000000000:\\
                                \;\;\;\;\frac{a}{k \cdot k}\\
                                
                                \mathbf{elif}\;m \leq 0.9:\\
                                \;\;\;\;\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 < -8e12

                                  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-+.f6433.2

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

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

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

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

                                    if -8e12 < m < 0.900000000000000022

                                    1. Initial program 92.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-+.f6491.8

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

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

                                    if 0.900000000000000022 < m

                                    1. Initial program 77.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-+.f643.0

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

                                      \[\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 rewrites26.7%

                                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(k \cdot a\right)\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 rewrites45.7%

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

                                      Alternative 7: 57.5% accurate, 4.5× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -4.3 \cdot 10^{-78}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.9:\\ \;\;\;\;\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 -4.3e-78)
                                         (/ a (* k k))
                                         (if (<= m 0.9) (/ a (fma 10.0 k 1.0)) (* (* (* k a) k) 99.0))))
                                      double code(double a, double k, double m) {
                                      	double tmp;
                                      	if (m <= -4.3e-78) {
                                      		tmp = a / (k * k);
                                      	} else if (m <= 0.9) {
                                      		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 <= -4.3e-78)
                                      		tmp = Float64(a / Float64(k * k));
                                      	elseif (m <= 0.9)
                                      		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, -4.3e-78], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.9], 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 -4.3 \cdot 10^{-78}:\\
                                      \;\;\;\;\frac{a}{k \cdot k}\\
                                      
                                      \mathbf{elif}\;m \leq 0.9:\\
                                      \;\;\;\;\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 < -4.29999999999999994e-78

                                        1. Initial program 98.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-+.f6440.7

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

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

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

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

                                          if -4.29999999999999994e-78 < m < 0.900000000000000022

                                          1. Initial program 92.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-+.f6492.9

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

                                            \[\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 rewrites74.0%

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

                                            if 0.900000000000000022 < m

                                            1. Initial program 77.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-+.f643.0

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

                                              \[\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 rewrites26.7%

                                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(k \cdot a\right)\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 rewrites45.7%

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

                                              Alternative 8: 53.1% accurate, 4.5× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -1.28 \cdot 10^{-138}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 7.2 \cdot 10^{-16}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(99, k, -10\right), k, a\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 -1.28e-138)
                                                 (/ a (* k k))
                                                 (if (<= m 7.2e-16)
                                                   (fma (* a (fma 99.0 k -10.0)) k a)
                                                   (* (* (* k a) k) 99.0))))
                                              double code(double a, double k, double m) {
                                              	double tmp;
                                              	if (m <= -1.28e-138) {
                                              		tmp = a / (k * k);
                                              	} else if (m <= 7.2e-16) {
                                              		tmp = fma((a * fma(99.0, k, -10.0)), k, a);
                                              	} else {
                                              		tmp = ((k * a) * k) * 99.0;
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(a, k, m)
                                              	tmp = 0.0
                                              	if (m <= -1.28e-138)
                                              		tmp = Float64(a / Float64(k * k));
                                              	elseif (m <= 7.2e-16)
                                              		tmp = fma(Float64(a * fma(99.0, k, -10.0)), k, a);
                                              	else
                                              		tmp = Float64(Float64(Float64(k * a) * k) * 99.0);
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[a_, k_, m_] := If[LessEqual[m, -1.28e-138], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 7.2e-16], N[(N[(a * N[(99.0 * k + -10.0), $MachinePrecision]), $MachinePrecision] * k + a), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;m \leq -1.28 \cdot 10^{-138}:\\
                                              \;\;\;\;\frac{a}{k \cdot k}\\
                                              
                                              \mathbf{elif}\;m \leq 7.2 \cdot 10^{-16}:\\
                                              \;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(99, k, -10\right), k, a\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 < -1.28e-138

                                                1. Initial program 99.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-+.f6447.8

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

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

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

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

                                                  if -1.28e-138 < m < 7.19999999999999965e-16

                                                  1. Initial program 91.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-+.f6491.6

                                                      \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                  5. Applied rewrites91.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 rewrites53.5%

                                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(k \cdot a\right)\right), \color{blue}{k}, a\right) \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites53.5%

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

                                                      if 7.19999999999999965e-16 < m

                                                      1. Initial program 77.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-+.f644.0

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

                                                        \[\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 rewrites26.5%

                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(k \cdot a\right)\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 rewrites45.3%

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

                                                        Alternative 9: 51.5% accurate, 4.8× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 8.6 \cdot 10^{-122}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.41:\\ \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\ \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 8.6e-122)
                                                           (/ a (* k k))
                                                           (if (<= m 0.41) (* (fma -10.0 k 1.0) a) (* (* (* k a) k) 99.0))))
                                                        double code(double a, double k, double m) {
                                                        	double tmp;
                                                        	if (m <= 8.6e-122) {
                                                        		tmp = a / (k * k);
                                                        	} else if (m <= 0.41) {
                                                        		tmp = fma(-10.0, k, 1.0) * a;
                                                        	} else {
                                                        		tmp = ((k * a) * k) * 99.0;
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        function code(a, k, m)
                                                        	tmp = 0.0
                                                        	if (m <= 8.6e-122)
                                                        		tmp = Float64(a / Float64(k * k));
                                                        	elseif (m <= 0.41)
                                                        		tmp = Float64(fma(-10.0, k, 1.0) * a);
                                                        	else
                                                        		tmp = Float64(Float64(Float64(k * a) * k) * 99.0);
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        code[a_, k_, m_] := If[LessEqual[m, 8.6e-122], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.41], N[(N[(-10.0 * k + 1.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        \mathbf{if}\;m \leq 8.6 \cdot 10^{-122}:\\
                                                        \;\;\;\;\frac{a}{k \cdot k}\\
                                                        
                                                        \mathbf{elif}\;m \leq 0.41:\\
                                                        \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\
                                                        
                                                        \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 < 8.60000000000000037e-122

                                                          1. Initial program 95.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-+.f6463.1

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

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

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

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

                                                            if 8.60000000000000037e-122 < m < 0.409999999999999976

                                                            1. Initial program 99.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-+.f6499.9

                                                                \[\leadsto \frac{a}{\mathsf{fma}\left(\color{blue}{10 + k}, k, 1\right)} \]
                                                            5. Applied rewrites99.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 rewrites77.9%

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

                                                              if 0.409999999999999976 < m

                                                              1. Initial program 77.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-+.f643.0

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

                                                                \[\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 rewrites26.7%

                                                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(k \cdot a\right)\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 rewrites45.7%

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

                                                                Alternative 10: 36.1% accurate, 6.1× speedup?

                                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 0.41:\\ \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\ \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.41) (* (fma -10.0 k 1.0) a) (* (* (* k a) k) 99.0)))
                                                                double code(double a, double k, double m) {
                                                                	double tmp;
                                                                	if (m <= 0.41) {
                                                                		tmp = fma(-10.0, k, 1.0) * a;
                                                                	} else {
                                                                		tmp = ((k * a) * k) * 99.0;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                function code(a, k, m)
                                                                	tmp = 0.0
                                                                	if (m <= 0.41)
                                                                		tmp = Float64(fma(-10.0, k, 1.0) * a);
                                                                	else
                                                                		tmp = Float64(Float64(Float64(k * a) * k) * 99.0);
                                                                	end
                                                                	return tmp
                                                                end
                                                                
                                                                code[a_, k_, m_] := If[LessEqual[m, 0.41], N[(N[(-10.0 * k + 1.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \begin{array}{l}
                                                                \mathbf{if}\;m \leq 0.41:\\
                                                                \;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\
                                                                
                                                                \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.409999999999999976

                                                                  1. Initial program 96.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-+.f6466.2

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

                                                                    \[\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 rewrites28.5%

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

                                                                    if 0.409999999999999976 < m

                                                                    1. Initial program 77.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-+.f643.0

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

                                                                      \[\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 rewrites26.7%

                                                                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(k \cdot a\right)\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 rewrites45.7%

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

                                                                      Alternative 11: 8.2% 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 88.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-+.f6442.0

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

                                                                        \[\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 rewrites19.8%

                                                                          \[\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 rewrites7.8%

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

                                                                          Reproduce

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