Falkner and Boettcher, Appendix A

Percentage Accurate: 90.3% → 99.7%
Time: 4.7s
Alternatives: 13
Speedup: 1.3×

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}

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 13 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.3% 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: 99.7% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;k \leq 10^{-83}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{10}{t\_0} + \frac{k}{t\_0}, k, \frac{1}{t\_0}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 1e-83

    1. Initial program 94.4%

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

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

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

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

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

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

    if 1e-83 < k

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(10 + k, k, 1\right)}{a}} \]
      3. Applied rewrites57.7%

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

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

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

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

          \[\leadsto \frac{1}{\mathsf{fma}\left(10 \cdot \frac{1}{a \cdot {k}^{m}} + \frac{k}{a \cdot {k}^{m}}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
        4. mult-flip-revN/A

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

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

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

          \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{a \cdot {k}^{m}}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
        8. lower-pow.f64N/A

          \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{a \cdot {k}^{m}}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
        9. lower-/.f64N/A

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

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

          \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{{k}^{m} \cdot a}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
        12. lower-pow.f64N/A

          \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{{k}^{m} \cdot a}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
        13. lower-/.f64N/A

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

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

          \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{{k}^{m} \cdot a}, k, \frac{1}{{k}^{m} \cdot a}\right)} \]
      6. Applied rewrites99.4%

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

    Alternative 2: 98.9% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := {k}^{m} \cdot a\\ \mathbf{if}\;m \leq -150:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 0.00026:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{10}{a} + \frac{k}{a}, k, \frac{1}{a}\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (a k m)
     :precision binary64
     (let* ((t_0 (* (pow k m) a)))
       (if (<= m -150.0)
         t_0
         (if (<= m 0.00026)
           (/ 1.0 (fma (+ (/ 10.0 a) (/ k a)) k (/ 1.0 a)))
           t_0))))
    double code(double a, double k, double m) {
    	double t_0 = pow(k, m) * a;
    	double tmp;
    	if (m <= -150.0) {
    		tmp = t_0;
    	} else if (m <= 0.00026) {
    		tmp = 1.0 / fma(((10.0 / a) + (k / a)), k, (1.0 / a));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(a, k, m)
    	t_0 = Float64((k ^ m) * a)
    	tmp = 0.0
    	if (m <= -150.0)
    		tmp = t_0;
    	elseif (m <= 0.00026)
    		tmp = Float64(1.0 / fma(Float64(Float64(10.0 / a) + Float64(k / a)), k, Float64(1.0 / a)));
    	else
    		tmp = 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, -150.0], t$95$0, If[LessEqual[m, 0.00026], N[(1.0 / N[(N[(N[(10.0 / a), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision] * k + N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := {k}^{m} \cdot a\\
    \mathbf{if}\;m \leq -150:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;m \leq 0.00026:\\
    \;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{10}{a} + \frac{k}{a}, k, \frac{1}{a}\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if m < -150 or 2.59999999999999977e-4 < m

      1. Initial program 88.5%

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

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

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

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

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

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

      if -150 < m < 2.59999999999999977e-4

      1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{\mathsf{fma}\left(10 \cdot \frac{1}{a \cdot {k}^{m}} + \frac{k}{a \cdot {k}^{m}}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
          4. mult-flip-revN/A

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

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

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

            \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{a \cdot {k}^{m}}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
          8. lower-pow.f64N/A

            \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{a \cdot {k}^{m}}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
          9. lower-/.f64N/A

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

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

            \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{{k}^{m} \cdot a}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
          12. lower-pow.f64N/A

            \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{{k}^{m} \cdot a}, k, \frac{1}{a \cdot {k}^{m}}\right)} \]
          13. lower-/.f64N/A

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

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

            \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{{k}^{m} \cdot a} + \frac{k}{{k}^{m} \cdot a}, k, \frac{1}{{k}^{m} \cdot a}\right)} \]
        6. Applied rewrites99.2%

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

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

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

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

            \[\leadsto \frac{1}{\mathsf{fma}\left(10 \cdot \frac{1}{a} + \frac{k}{a}, k, \frac{1}{a}\right)} \]
          4. mult-flip-revN/A

            \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{a} + \frac{k}{a}, k, \frac{1}{a}\right)} \]
          5. lower-/.f64N/A

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

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

            \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{10}{a} + \frac{k}{a}, k, \frac{1}{a}\right)} \]
        9. Applied rewrites97.2%

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

      Alternative 3: 97.0% accurate, 1.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {k}^{m} \cdot a\\ \mathbf{if}\;m \leq -150:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 4.5 \cdot 10^{-6}:\\ \;\;\;\;a \cdot \frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (a k m)
       :precision binary64
       (let* ((t_0 (* (pow k m) a)))
         (if (<= m -150.0)
           t_0
           (if (<= m 4.5e-6) (* a (/ 1.0 (fma (+ 10.0 k) k 1.0))) t_0))))
      double code(double a, double k, double m) {
      	double t_0 = pow(k, m) * a;
      	double tmp;
      	if (m <= -150.0) {
      		tmp = t_0;
      	} else if (m <= 4.5e-6) {
      		tmp = a * (1.0 / fma((10.0 + k), k, 1.0));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(a, k, m)
      	t_0 = Float64((k ^ m) * a)
      	tmp = 0.0
      	if (m <= -150.0)
      		tmp = t_0;
      	elseif (m <= 4.5e-6)
      		tmp = Float64(a * Float64(1.0 / fma(Float64(10.0 + k), k, 1.0)));
      	else
      		tmp = 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, -150.0], t$95$0, If[LessEqual[m, 4.5e-6], N[(a * N[(1.0 / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {k}^{m} \cdot a\\
      \mathbf{if}\;m \leq -150:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;m \leq 4.5 \cdot 10^{-6}:\\
      \;\;\;\;a \cdot \frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if m < -150 or 4.50000000000000011e-6 < m

        1. Initial program 88.5%

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

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

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

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

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

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

        if -150 < m < 4.50000000000000011e-6

        1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto a \cdot \mathsf{Rewrite=>}\left(lower-/.f64, \left(\frac{1}{1 + k \cdot \left(10 + k\right)}\right)\right) \]
            14. *-commutativeN/A

              \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite=>}\left(+-commutative, \left(k \cdot \left(10 + k\right) + 1\right)\right)} \]
            15. *-commutativeN/A

              \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(*-commutative, \left(\left(10 + k\right) \cdot k\right)\right) + 1} \]
            16. *-commutativeN/A

              \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(lift-fma.f64, \left(\mathsf{fma}\left(10 + k, k, 1\right)\right)\right)} \]
            17. *-commutativeN/A

              \[\leadsto a \cdot \frac{1}{\mathsf{fma}\left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(10 + k\right)\right), k, 1\right)} \]
          3. Applied rewrites91.9%

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

        Alternative 4: 60.5% accurate, 1.4× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
              2. lower-*.f6460.9

                \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
            6. Applied rewrites60.9%

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

            if -150 < m < 2

            1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto a \cdot \mathsf{Rewrite=>}\left(lower-/.f64, \left(\frac{1}{1 + k \cdot \left(10 + k\right)}\right)\right) \]
                14. *-commutativeN/A

                  \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite=>}\left(+-commutative, \left(k \cdot \left(10 + k\right) + 1\right)\right)} \]
                15. *-commutativeN/A

                  \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(*-commutative, \left(\left(10 + k\right) \cdot k\right)\right) + 1} \]
                16. *-commutativeN/A

                  \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(lift-fma.f64, \left(\mathsf{fma}\left(10 + k, k, 1\right)\right)\right)} \]
                17. *-commutativeN/A

                  \[\leadsto a \cdot \frac{1}{\mathsf{fma}\left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(10 + k\right)\right), k, 1\right)} \]
              3. Applied rewrites91.5%

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

              if 2 < m < 6.2000000000000004e188

              1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto a \cdot \mathsf{Rewrite=>}\left(lower-/.f64, \left(\frac{1}{1 + k \cdot \left(10 + k\right)}\right)\right) \]
                  14. *-commutativeN/A

                    \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite=>}\left(+-commutative, \left(k \cdot \left(10 + k\right) + 1\right)\right)} \]
                  15. *-commutativeN/A

                    \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(*-commutative, \left(\left(10 + k\right) \cdot k\right)\right) + 1} \]
                  16. *-commutativeN/A

                    \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(lift-fma.f64, \left(\mathsf{fma}\left(10 + k, k, 1\right)\right)\right)} \]
                  17. *-commutativeN/A

                    \[\leadsto a \cdot \frac{1}{\mathsf{fma}\left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(10 + k\right)\right), k, 1\right)} \]
                3. Applied rewrites3.1%

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

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

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

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

                    \[\leadsto a \cdot \mathsf{fma}\left(99 \cdot k - 10, \color{blue}{k}, 1\right) \]
                  4. sub-flipN/A

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

                    \[\leadsto a \cdot \mathsf{fma}\left(99 \cdot k + -10, k, 1\right) \]
                  6. lower-fma.f6432.1

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

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

                if 6.2000000000000004e188 < m

                1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(k \cdot a, -10, a\right) \]
                  5. lower-*.f646.2

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

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

                  \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                9. Step-by-step derivation
                  1. *-commutativeN/A

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

                    \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                  3. lower-*.f6418.3

                    \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                10. Applied rewrites18.3%

                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                11. Step-by-step derivation
                  1. lift-*.f64N/A

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

                    \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                  3. associate-*l*N/A

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

                    \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                  5. lower-*.f64N/A

                    \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                  6. lower-*.f6418.3

                    \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                12. Applied rewrites18.3%

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

              Alternative 5: 60.5% accurate, 1.4× speedup?

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

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
                    2. lower-*.f6460.9

                      \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
                  6. Applied rewrites60.9%

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

                  if -150 < m < 2

                  1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

                  if 2 < m < 6.2000000000000004e188

                  1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto a \cdot \mathsf{Rewrite=>}\left(lower-/.f64, \left(\frac{1}{1 + k \cdot \left(10 + k\right)}\right)\right) \]
                      14. *-commutativeN/A

                        \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite=>}\left(+-commutative, \left(k \cdot \left(10 + k\right) + 1\right)\right)} \]
                      15. *-commutativeN/A

                        \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(*-commutative, \left(\left(10 + k\right) \cdot k\right)\right) + 1} \]
                      16. *-commutativeN/A

                        \[\leadsto a \cdot \frac{1}{\mathsf{Rewrite<=}\left(lift-fma.f64, \left(\mathsf{fma}\left(10 + k, k, 1\right)\right)\right)} \]
                      17. *-commutativeN/A

                        \[\leadsto a \cdot \frac{1}{\mathsf{fma}\left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(10 + k\right)\right), k, 1\right)} \]
                    3. Applied rewrites3.1%

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

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

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

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

                        \[\leadsto a \cdot \mathsf{fma}\left(99 \cdot k - 10, \color{blue}{k}, 1\right) \]
                      4. sub-flipN/A

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

                        \[\leadsto a \cdot \mathsf{fma}\left(99 \cdot k + -10, k, 1\right) \]
                      6. lower-fma.f6432.1

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

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

                    if 6.2000000000000004e188 < m

                    1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(k \cdot a, -10, a\right) \]
                      5. lower-*.f646.2

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

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

                      \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                    9. Step-by-step derivation
                      1. *-commutativeN/A

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

                        \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                      3. lower-*.f6418.3

                        \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                    10. Applied rewrites18.3%

                      \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                    11. Step-by-step derivation
                      1. lift-*.f64N/A

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

                        \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                      3. associate-*l*N/A

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

                        \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                      5. lower-*.f64N/A

                        \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                      6. lower-*.f6418.3

                        \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                    12. Applied rewrites18.3%

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

                  Alternative 6: 58.2% accurate, 1.8× speedup?

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

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
                        2. lower-*.f6460.9

                          \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
                      6. Applied rewrites60.9%

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

                      if -150 < m < 2.3e10

                      1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

                      if 2.3e10 < m

                      1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                      9. Step-by-step derivation
                        1. *-commutativeN/A

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

                          \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                        3. lower-*.f6420.1

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

                        \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                      11. Step-by-step derivation
                        1. lift-*.f64N/A

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

                          \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                        3. associate-*l*N/A

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

                          \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                        5. lower-*.f64N/A

                          \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                        6. lower-*.f6420.1

                          \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                      12. Applied rewrites20.1%

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

                    Alternative 7: 57.1% accurate, 2.0× speedup?

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

                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(10 + k, k, 1\right)}{a}} \]
                        3. Applied rewrites34.7%

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

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

                            \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
                          2. lower-*.f6461.1

                            \[\leadsto \frac{1}{\frac{k \cdot \color{blue}{k}}{a}} \]
                        6. Applied rewrites61.1%

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

                        if -1.05e17 < m < 1.05e6

                        1. Initial program 93.7%

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)} \]
                        4. Applied rewrites88.8%

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

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

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

                          if 1.05e6 < m

                          1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(k \cdot a, -10, a\right) \]
                            5. lower-*.f647.6

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

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

                            \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                          9. Step-by-step derivation
                            1. *-commutativeN/A

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

                              \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                            3. lower-*.f6420.0

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

                            \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                          11. Step-by-step derivation
                            1. lift-*.f64N/A

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

                              \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                            3. associate-*l*N/A

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

                              \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                            5. lower-*.f64N/A

                              \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                            6. lower-*.f6420.1

                              \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                          12. Applied rewrites20.1%

                            \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                        7. Recombined 3 regimes into one program.
                        8. Add Preprocessing

                        Alternative 8: 57.0% accurate, 2.0× speedup?

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

                          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \frac{a}{{k}^{2}} \]
                            2. +-commutativeN/A

                              \[\leadsto \frac{a}{{k}^{2}} \]
                            3. distribute-rgt-inN/A

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

                              \[\leadsto \frac{a}{{k}^{2}} \]
                            5. associate-+l+N/A

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

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

                              \[\leadsto \frac{a}{k \cdot k} \]
                            8. lift-*.f6460.9

                              \[\leadsto \frac{a}{k \cdot k} \]
                          7. Applied rewrites60.9%

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

                          if -1.05e17 < m < 1.05e6

                          1. Initial program 93.7%

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

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

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

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

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

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

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

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

                              \[\leadsto \frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)} \]
                          4. Applied rewrites88.8%

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

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

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

                            if 1.05e6 < m

                            1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(k \cdot a, -10, a\right) \]
                              5. lower-*.f647.6

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

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

                              \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                            9. Step-by-step derivation
                              1. *-commutativeN/A

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

                                \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                              3. lower-*.f6420.0

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

                              \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                            11. Step-by-step derivation
                              1. lift-*.f64N/A

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

                                \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                              3. associate-*l*N/A

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

                                \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                              5. lower-*.f64N/A

                                \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                              6. lower-*.f6420.1

                                \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                            12. Applied rewrites20.1%

                              \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                          7. Recombined 3 regimes into one program.
                          8. Add Preprocessing

                          Alternative 9: 47.8% accurate, 2.0× speedup?

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

                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{a}{{k}^{2}} \]
                              2. +-commutativeN/A

                                \[\leadsto \frac{a}{{k}^{2}} \]
                              3. distribute-rgt-inN/A

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

                                \[\leadsto \frac{a}{{k}^{2}} \]
                              5. associate-+l+N/A

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

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

                                \[\leadsto \frac{a}{k \cdot k} \]
                              8. lift-*.f6460.7

                                \[\leadsto \frac{a}{k \cdot k} \]
                            7. Applied rewrites60.7%

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

                            if -150 < m < 1.99999999999999992e28

                            1. Initial program 92.4%

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)} \]
                            4. Applied rewrites85.8%

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

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

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

                              if 1.99999999999999992e28 < m

                              1. Initial program 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                              9. Step-by-step derivation
                                1. *-commutativeN/A

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

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                3. lower-*.f6420.1

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

                                \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                              11. Step-by-step derivation
                                1. lift-*.f64N/A

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

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                3. associate-*l*N/A

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

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                5. lower-*.f64N/A

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                6. lower-*.f6420.1

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                              12. Applied rewrites20.1%

                                \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                            7. Recombined 3 regimes into one program.
                            8. Add Preprocessing

                            Alternative 10: 42.7% accurate, 2.1× speedup?

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

                              1. Initial program 89.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                              9. Step-by-step derivation
                                1. *-commutativeN/A

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

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                3. lower-*.f6415.5

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                              10. Applied rewrites15.5%

                                \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                              11. Step-by-step derivation
                                1. lift-*.f64N/A

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

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                3. associate-*l*N/A

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

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                5. lower-*.f64N/A

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                6. lower-*.f6415.6

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                              12. Applied rewrites15.6%

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

                              if 4.999999999999985e-310 < k < 0.112000000000000002

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(k \cdot a, -10, a\right) \]
                                5. lower-*.f6449.3

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

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

                              if 0.112000000000000002 < k

                              1. Initial program 81.1%

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{a}{{k}^{2}} \]
                                2. +-commutativeN/A

                                  \[\leadsto \frac{a}{{k}^{2}} \]
                                3. distribute-rgt-inN/A

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

                                  \[\leadsto \frac{a}{{k}^{2}} \]
                                5. associate-+l+N/A

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

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

                                  \[\leadsto \frac{a}{k \cdot k} \]
                                8. lift-*.f6458.7

                                  \[\leadsto \frac{a}{k \cdot k} \]
                              7. Applied rewrites58.7%

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

                            Alternative 11: 42.5% accurate, 2.3× speedup?

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

                              1. Initial program 89.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                              9. Step-by-step derivation
                                1. *-commutativeN/A

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

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                3. lower-*.f6415.5

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                              10. Applied rewrites15.5%

                                \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                              11. Step-by-step derivation
                                1. lift-*.f64N/A

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

                                  \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                3. associate-*l*N/A

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

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                5. lower-*.f64N/A

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                6. lower-*.f6415.6

                                  \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                              12. Applied rewrites15.6%

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

                              if 4.999999999999985e-310 < k < 820

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)} \]
                              4. Applied rewrites49.7%

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

                                \[\leadsto a \]
                              6. Step-by-step derivation
                                1. Applied rewrites48.3%

                                  \[\leadsto a \]

                                if 820 < k

                                1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{a}{{k}^{2}} \]
                                  2. +-commutativeN/A

                                    \[\leadsto \frac{a}{{k}^{2}} \]
                                  3. distribute-rgt-inN/A

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

                                    \[\leadsto \frac{a}{{k}^{2}} \]
                                  5. associate-+l+N/A

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

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

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

                                    \[\leadsto \frac{a}{k \cdot k} \]
                                7. Applied rewrites59.3%

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

                              Alternative 12: 25.2% accurate, 3.2× speedup?

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

                                1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto a \]
                                6. Step-by-step derivation
                                  1. Applied rewrites27.4%

                                    \[\leadsto a \]

                                  if 1.99999999999999992e28 < m

                                  1. Initial program 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
                                  9. Step-by-step derivation
                                    1. *-commutativeN/A

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

                                      \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                    3. lower-*.f6420.1

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

                                    \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                  11. Step-by-step derivation
                                    1. lift-*.f64N/A

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

                                      \[\leadsto \left(a \cdot k\right) \cdot -10 \]
                                    3. associate-*l*N/A

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

                                      \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                    5. lower-*.f64N/A

                                      \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                    6. lower-*.f6420.1

                                      \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                  12. Applied rewrites20.1%

                                    \[\leadsto a \cdot \left(-10 \cdot k\right) \]
                                7. Recombined 2 regimes into one program.
                                8. Add Preprocessing

                                Alternative 13: 20.2% accurate, 34.5× speedup?

                                \[\begin{array}{l} \\ a \end{array} \]
                                (FPCore (a k m) :precision binary64 a)
                                double code(double a, double k, double m) {
                                	return a;
                                }
                                
                                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
                                end function
                                
                                public static double code(double a, double k, double m) {
                                	return a;
                                }
                                
                                def code(a, k, m):
                                	return a
                                
                                function code(a, k, m)
                                	return a
                                end
                                
                                function tmp = code(a, k, m)
                                	tmp = a;
                                end
                                
                                code[a_, k_, m_] := a
                                
                                \begin{array}{l}
                                
                                \\
                                a
                                \end{array}
                                
                                Derivation
                                1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto a \]
                                6. Step-by-step derivation
                                  1. Applied rewrites20.2%

                                    \[\leadsto a \]
                                  2. Add Preprocessing

                                  Reproduce

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