Falkner and Boettcher, Appendix A

Percentage Accurate: 90.9% → 97.6%
Time: 8.0s
Alternatives: 12
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
	return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m):
	return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function tmp = code(a, k, m)
	tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

real(8) function code(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
	return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m):
	return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function tmp = code(a, k, m)
	tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 97.6% accurate, 1.0× speedup?

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

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

real(8) function code(a, k, m)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= 0.00145d0) then
        tmp = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
    else
        tmp = (k ** m) * a
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= 0.00145) {
		tmp = (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
	} else {
		tmp = Math.pow(k, m) * a;
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= 0.00145:
		tmp = (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
	else:
		tmp = math.pow(k, m) * a
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= 0.00145)
		tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)));
	else
		tmp = Float64((k ^ m) * a);
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= 0.00145)
		tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
	else
		tmp = (k ^ m) * a;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, 0.00145], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < 0.00145

    1. Initial program 95.7%

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

    if 0.00145 < m

    1. Initial program 79.8%

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    4. Step-by-step derivation
      1. Applied rewrites100.0%

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

    Alternative 2: 97.6% accurate, 1.0× speedup?

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

      1. Initial program 95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 0.00145 < m

      1. Initial program 79.8%

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

        \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
      4. Step-by-step derivation
        1. Applied rewrites100.0%

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

      Alternative 3: 97.1% accurate, 1.1× speedup?

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

        1. Initial program 89.3%

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

          \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
        4. Step-by-step derivation
          1. Applied rewrites100.0%

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

          if -4.80000000000000012e-4 < m < 8.9999999999999999e-11

          1. Initial program 91.7%

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

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

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

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

          Alternative 4: 63.5% accurate, 1.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -14.2:\\ \;\;\;\;\frac{a - \frac{\mathsf{fma}\left(a, 10, -99 \cdot \frac{a}{k}\right)}{k}}{k \cdot k}\\ \mathbf{elif}\;m \leq 640:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\ \mathbf{elif}\;m \leq 2.1 \cdot 10^{+70} \lor \neg \left(m \leq 2.3 \cdot 10^{+153}\right):\\ \;\;\;\;\frac{a}{\frac{\left(\left(100 - \frac{\frac{1}{k}}{k}\right) \cdot k\right) \cdot k}{\mathsf{fma}\left(10, k, -1\right)} + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(a \cdot k\right)\right), k, a\right)\\ \end{array} \end{array} \]
          (FPCore (a k m)
           :precision binary64
           (if (<= m -14.2)
             (/ (- a (/ (fma a 10.0 (* -99.0 (/ a k))) k)) (* k k))
             (if (<= m 640.0)
               (/ a (fma (- k -10.0) k 1.0))
               (if (or (<= m 2.1e+70) (not (<= m 2.3e+153)))
                 (/
                  a
                  (+
                   (/ (* (* (- 100.0 (/ (/ 1.0 k) k)) k) k) (fma 10.0 k -1.0))
                   (* k k)))
                 (fma (fma -10.0 a (* 99.0 (* a k))) k a)))))
          double code(double a, double k, double m) {
          	double tmp;
          	if (m <= -14.2) {
          		tmp = (a - (fma(a, 10.0, (-99.0 * (a / k))) / k)) / (k * k);
          	} else if (m <= 640.0) {
          		tmp = a / fma((k - -10.0), k, 1.0);
          	} else if ((m <= 2.1e+70) || !(m <= 2.3e+153)) {
          		tmp = a / (((((100.0 - ((1.0 / k) / k)) * k) * k) / fma(10.0, k, -1.0)) + (k * k));
          	} else {
          		tmp = fma(fma(-10.0, a, (99.0 * (a * k))), k, a);
          	}
          	return tmp;
          }
          
          function code(a, k, m)
          	tmp = 0.0
          	if (m <= -14.2)
          		tmp = Float64(Float64(a - Float64(fma(a, 10.0, Float64(-99.0 * Float64(a / k))) / k)) / Float64(k * k));
          	elseif (m <= 640.0)
          		tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0));
          	elseif ((m <= 2.1e+70) || !(m <= 2.3e+153))
          		tmp = Float64(a / Float64(Float64(Float64(Float64(Float64(100.0 - Float64(Float64(1.0 / k) / k)) * k) * k) / fma(10.0, k, -1.0)) + Float64(k * k)));
          	else
          		tmp = fma(fma(-10.0, a, Float64(99.0 * Float64(a * k))), k, a);
          	end
          	return tmp
          end
          
          code[a_, k_, m_] := If[LessEqual[m, -14.2], N[(N[(a - N[(N[(a * 10.0 + N[(-99.0 * N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 640.0], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, 2.1e+70], N[Not[LessEqual[m, 2.3e+153]], $MachinePrecision]], N[(a / N[(N[(N[(N[(N[(100.0 - N[(N[(1.0 / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision] / N[(10.0 * k + -1.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-10.0 * a + N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k + a), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;m \leq -14.2:\\
          \;\;\;\;\frac{a - \frac{\mathsf{fma}\left(a, 10, -99 \cdot \frac{a}{k}\right)}{k}}{k \cdot k}\\
          
          \mathbf{elif}\;m \leq 640:\\
          \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
          
          \mathbf{elif}\;m \leq 2.1 \cdot 10^{+70} \lor \neg \left(m \leq 2.3 \cdot 10^{+153}\right):\\
          \;\;\;\;\frac{a}{\frac{\left(\left(100 - \frac{\frac{1}{k}}{k}\right) \cdot k\right) \cdot k}{\mathsf{fma}\left(10, k, -1\right)} + k \cdot k}\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(a \cdot k\right)\right), k, a\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 4 regimes
          2. if m < -14.199999999999999

            1. Initial program 100.0%

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

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

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

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

                  \[\leadsto a \]
                2. Taylor expanded in k around -inf

                  \[\leadsto \frac{a + -1 \cdot \frac{-1 \cdot \frac{\left(10 \cdot \frac{a}{k} + 10 \cdot \frac{a + -100 \cdot a}{k}\right) - \left(a + -100 \cdot a\right)}{k} - -10 \cdot a}{k}}{\color{blue}{{k}^{2}}} \]
                3. Applied rewrites55.0%

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

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

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

                  if -14.199999999999999 < m < 640

                  1. Initial program 92.0%

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

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

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

                    if 640 < m < 2.10000000000000008e70 or 2.3000000000000001e153 < m

                    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \frac{a}{\frac{\mathsf{fma}\left(\color{blue}{100}, k \cdot k, \mathsf{neg}\left(1\right)\right)}{10 \cdot k - 1} + k \cdot k} \]
                        15. metadata-evalN/A

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

                          \[\leadsto \frac{a}{\frac{\mathsf{fma}\left(100, k \cdot k, -1\right)}{10 \cdot k - \color{blue}{1 \cdot 1}} + k \cdot k} \]
                        17. fp-cancel-sub-sign-invN/A

                          \[\leadsto \frac{a}{\frac{\mathsf{fma}\left(100, k \cdot k, -1\right)}{\color{blue}{10 \cdot k + \left(\mathsf{neg}\left(1\right)\right) \cdot 1}} + k \cdot k} \]
                        18. lift-*.f64N/A

                          \[\leadsto \frac{a}{\frac{\mathsf{fma}\left(100, k \cdot k, -1\right)}{\color{blue}{10 \cdot k} + \left(\mathsf{neg}\left(1\right)\right) \cdot 1} + k \cdot k} \]
                        19. metadata-evalN/A

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

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

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

                          \[\leadsto \frac{a}{\frac{\mathsf{fma}\left(100, k \cdot k, -1\right)}{\color{blue}{\mathsf{fma}\left(10, k, \mathsf{neg}\left(1\right)\right)}} + k \cdot k} \]
                        23. metadata-eval2.9

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

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

                        \[\leadsto \frac{a}{\frac{\color{blue}{{k}^{2} \cdot \left(100 - \frac{1}{{k}^{2}}\right)}}{\mathsf{fma}\left(10, k, -1\right)} + k \cdot k} \]
                      5. Step-by-step derivation
                        1. Applied rewrites31.0%

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

                        if 2.10000000000000008e70 < m < 2.3000000000000001e153

                        1. Initial program 60.0%

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(a \cdot k\right)\right), \color{blue}{k}, a\right) \]
                          4. Recombined 4 regimes into one program.
                          5. Final simplification64.3%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -14.2:\\ \;\;\;\;\frac{a - \frac{\mathsf{fma}\left(a, 10, -99 \cdot \frac{a}{k}\right)}{k}}{k \cdot k}\\ \mathbf{elif}\;m \leq 640:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\ \mathbf{elif}\;m \leq 2.1 \cdot 10^{+70} \lor \neg \left(m \leq 2.3 \cdot 10^{+153}\right):\\ \;\;\;\;\frac{a}{\frac{\left(\left(100 - \frac{\frac{1}{k}}{k}\right) \cdot k\right) \cdot k}{\mathsf{fma}\left(10, k, -1\right)} + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-10, a, 99 \cdot \left(a \cdot k\right)\right), k, a\right)\\ \end{array} \]
                          6. Add Preprocessing

                          Alternative 5: 62.5% accurate, 2.3× speedup?

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

                            1. Initial program 100.0%

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

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

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

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

                                  \[\leadsto a \]
                                2. Taylor expanded in k around -inf

                                  \[\leadsto \frac{a + -1 \cdot \frac{-1 \cdot \frac{\left(10 \cdot \frac{a}{k} + 10 \cdot \frac{a + -100 \cdot a}{k}\right) - \left(a + -100 \cdot a\right)}{k} - -10 \cdot a}{k}}{\color{blue}{{k}^{2}}} \]
                                3. Applied rewrites55.0%

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

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

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

                                  if -14.199999999999999 < m < 6.1999999999999998e-15

                                  1. Initial program 91.7%

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

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

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

                                    if 6.1999999999999998e-15 < m

                                    1. Initial program 80.0%

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

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

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

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

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

                                      Alternative 6: 60.7% accurate, 3.8× speedup?

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

                                        1. Initial program 100.0%

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

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

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

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

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

                                            if -14.199999999999999 < m < 6.1999999999999998e-15

                                            1. Initial program 91.7%

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

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

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

                                              if 6.1999999999999998e-15 < m

                                              1. Initial program 80.0%

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

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

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

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

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

                                                Alternative 7: 58.4% accurate, 4.1× speedup?

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

                                                  1. Initial program 100.0%

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

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

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

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

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

                                                      if -14.199999999999999 < m < 3.8e20

                                                      1. Initial program 92.2%

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

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

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

                                                        if 3.8e20 < m

                                                        1. Initial program 78.6%

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

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

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

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

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

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

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

                                                            Alternative 8: 47.4% accurate, 4.5× speedup?

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

                                                              1. Initial program 84.8%

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

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

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

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

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

                                                                  if 9.79999999999999995e-297 < k < 10

                                                                  1. Initial program 100.0%

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

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

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

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

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

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

                                                                    Alternative 9: 57.5% accurate, 4.5× speedup?

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

                                                                      1. Initial program 100.0%

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

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

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

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

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

                                                                          if -14.199999999999999 < m < 3.8e20

                                                                          1. Initial program 92.2%

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

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

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

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

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

                                                                              if 3.8e20 < m

                                                                              1. Initial program 78.6%

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

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

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

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

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

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

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

                                                                                  Alternative 10: 47.0% accurate, 4.6× speedup?

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

                                                                                    1. Initial program 85.2%

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

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

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

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

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

                                                                                        if 9.79999999999999995e-297 < k < 1.15000000000000007e-11

                                                                                        1. Initial program 100.0%

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

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

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

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

                                                                                              \[\leadsto \mathsf{fma}\left(a \cdot k, \color{blue}{-10}, a\right) \]
                                                                                          4. Recombined 2 regimes into one program.
                                                                                          5. Final simplification47.9%

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

                                                                                          Alternative 11: 24.4% accurate, 7.9× speedup?

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

                                                                                            1. Initial program 95.8%

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

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

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

                                                                                                \[\leadsto a \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites27.7%

                                                                                                  \[\leadsto a \]

                                                                                                if 3.8e20 < m

                                                                                                1. Initial program 78.6%

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

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

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

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

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

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

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

                                                                                                    Alternative 12: 19.5% accurate, 134.0× 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.1%

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

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

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

                                                                                                        \[\leadsto a \]
                                                                                                      3. Step-by-step derivation
                                                                                                        1. Applied rewrites19.8%

                                                                                                          \[\leadsto a \]
                                                                                                        2. Add Preprocessing

                                                                                                        Reproduce

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