Falkner and Boettcher, Appendix A

Percentage Accurate: 90.4% → 97.9%
Time: 5.3s
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.4% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 97.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 97.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. lift-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    5. Applied rewrites100.0%

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

Alternative 2: 45.5% accurate, 0.3× speedup?

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

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

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

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

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


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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      8. lower-*.f6441.0

        \[\leadsto \frac{a}{k \cdot k} \]
    8. Applied rewrites41.0%

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

    if 1e-205 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 2.0000000000000001e299

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-10 \cdot k + 1\right) \cdot a \]
      4. lower-fma.f6468.7

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(k \cdot \left(-1 \cdot \left(k \cdot \left(-10 \cdot a + -10 \cdot \left(a + -100 \cdot a\right)\right)\right) - \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
    8. Applied rewrites25.0%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      6. lift-*.f6488.6

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

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

      \[\leadsto \mathsf{fma}\left(99 \cdot \left(a \cdot k\right), k, a\right) \]
    13. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(a \cdot k\right) \cdot 99, k, a\right) \]
      2. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
      4. lift-*.f6488.6

        \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
    14. Applied rewrites88.6%

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

Alternative 3: 22.1% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(k \cdot a\right) \cdot -10 \]
      4. lift-*.f6411.4

        \[\leadsto \left(k \cdot a\right) \cdot -10 \]
    11. Applied rewrites11.4%

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

    if 1.99999997e-317 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k)))

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(k \cdot \left(-1 \cdot \left(k \cdot \left(-10 \cdot a + -10 \cdot \left(a + -100 \cdot a\right)\right)\right) - \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
    8. Applied rewrites30.3%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      6. lift-*.f6445.8

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
    11. Applied rewrites45.8%

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

      \[\leadsto \mathsf{fma}\left(99 \cdot \left(a \cdot k\right), k, a\right) \]
    13. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(a \cdot k\right) \cdot 99, k, a\right) \]
      2. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
      4. lift-*.f6445.0

        \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
    14. Applied rewrites45.0%

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

Alternative 4: 97.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\mathsf{fma}\left(10, k, 1\right)}\\

\mathbf{elif}\;m \leq 3 \cdot 10^{-8}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if m < -2.6999999999999998e-12

    1. Initial program 100.0%

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

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

        \[\leadsto \frac{a \cdot {k}^{m}}{10 \cdot k + \color{blue}{1}} \]
      2. lower-fma.f6499.1

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

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

    if -2.6999999999999998e-12 < m < 2.99999999999999973e-8

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

    if 2.99999999999999973e-8 < 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 k around 0

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    5. Applied rewrites100.0%

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

Alternative 5: 97.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.6 \cdot 10^{-11} \lor \neg \left(m \leq 3 \cdot 10^{-8}\right):\\
\;\;\;\;{k}^{m} \cdot a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -1.59999999999999997e-11 or 2.99999999999999973e-8 < m

    1. Initial program 91.1%

      \[\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. *-commutativeN/A

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

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

        \[\leadsto {k}^{m} \cdot a \]
    5. Applied rewrites98.4%

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

    if -1.59999999999999997e-11 < m < 2.99999999999999973e-8

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 61.4% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.25:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(-99, \frac{a}{k}, 10 \cdot a\right)}{k}, -1, a\right)}{k \cdot k}\\

\mathbf{elif}\;m \leq 2:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\

\mathbf{elif}\;m \leq 1.05 \cdot 10^{+201}:\\
\;\;\;\;\mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right)\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25 < m < 2

    1. Initial program 94.9%

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

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

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

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

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

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

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

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

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

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

    if 2 < m < 1.05e201

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(k \cdot \left(-1 \cdot \left(k \cdot \left(-10 \cdot a + -10 \cdot \left(a + -100 \cdot a\right)\right)\right) - \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
    8. Applied rewrites11.6%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      6. lift-*.f6427.0

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
    11. Applied rewrites27.0%

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

      \[\leadsto \mathsf{fma}\left(99 \cdot \left(a \cdot k\right), k, a\right) \]
    13. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left(a \cdot k\right) \cdot 99, k, a\right) \]
      2. lower-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
      4. lift-*.f6427.0

        \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
    14. Applied rewrites27.0%

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

    if 1.05e201 < m

    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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(k \cdot a\right) \cdot -10 \]
      4. lift-*.f6445.7

        \[\leadsto \left(k \cdot a\right) \cdot -10 \]
    11. Applied rewrites45.7%

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

Alternative 7: 59.6% accurate, 3.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.25:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\

\mathbf{elif}\;m \leq 2:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\

\mathbf{elif}\;m \leq 1.05 \cdot 10^{+201}:\\
\;\;\;\;\mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right)\\

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


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

    1. Initial program 100.0%

      \[\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. lift-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \frac{{k}^{m}}{k \cdot \color{blue}{k}} \]
      8. lower-*.f6497.9

        \[\leadsto a \cdot \frac{{k}^{m}}{k \cdot \color{blue}{k}} \]
    7. Applied rewrites97.9%

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

      \[\leadsto a \cdot \frac{\color{blue}{1}}{k \cdot k} \]
    9. Step-by-step derivation
      1. Applied rewrites61.6%

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

      if -1.25 < m < 2

      1. Initial program 94.9%

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

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

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

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

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

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

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

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

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

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

      if 2 < m < 1.05e201

      1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(k \cdot \left(-1 \cdot \left(k \cdot \left(-10 \cdot a + -10 \cdot \left(a + -100 \cdot a\right)\right)\right) - \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
      8. Applied rewrites11.6%

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
        5. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
        6. lift-*.f6427.0

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      11. Applied rewrites27.0%

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

        \[\leadsto \mathsf{fma}\left(99 \cdot \left(a \cdot k\right), k, a\right) \]
      13. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\left(a \cdot k\right) \cdot 99, k, a\right) \]
        2. lower-*.f64N/A

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

          \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
        4. lift-*.f6427.0

          \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
      14. Applied rewrites27.0%

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

      if 1.05e201 < m

      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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(k \cdot a\right) \cdot -10 \]
        4. lift-*.f6445.7

          \[\leadsto \left(k \cdot a\right) \cdot -10 \]
      11. Applied rewrites45.7%

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

    Alternative 8: 59.3% accurate, 3.8× speedup?

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{a}{k \cdot k} \]
        8. lower-*.f6459.6

          \[\leadsto \frac{a}{k \cdot k} \]
      8. Applied rewrites59.6%

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

      if -1.25 < m < 2

      1. Initial program 94.9%

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

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

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

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

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

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

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

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

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

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

      if 2 < m < 1.05e201

      1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(k \cdot \left(-1 \cdot \left(k \cdot \left(-10 \cdot a + -10 \cdot \left(a + -100 \cdot a\right)\right)\right) - \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
      8. Applied rewrites11.6%

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
        5. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
        6. lift-*.f6427.0

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
      11. Applied rewrites27.0%

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

        \[\leadsto \mathsf{fma}\left(99 \cdot \left(a \cdot k\right), k, a\right) \]
      13. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\left(a \cdot k\right) \cdot 99, k, a\right) \]
        2. lower-*.f64N/A

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

          \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
        4. lift-*.f6427.0

          \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
      14. Applied rewrites27.0%

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

      if 1.05e201 < m

      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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(k \cdot a\right) \cdot -10 \]
        4. lift-*.f6445.7

          \[\leadsto \left(k \cdot a\right) \cdot -10 \]
      11. Applied rewrites45.7%

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

    Alternative 9: 58.5% accurate, 3.8× speedup?

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{a}{k \cdot k} \]
        8. lower-*.f6459.6

          \[\leadsto \frac{a}{k \cdot k} \]
      8. Applied rewrites59.6%

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

      if -1.25 < m < 2

      1. Initial program 94.9%

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

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

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

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

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

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

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

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

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

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

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

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

        if 2 < m < 1.05e201

        1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(k \cdot \left(-1 \cdot \left(k \cdot \left(-10 \cdot a + -10 \cdot \left(a + -100 \cdot a\right)\right)\right) - \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
        8. Applied rewrites11.6%

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
          5. lower-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
          6. lift-*.f6427.0

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
        11. Applied rewrites27.0%

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

          \[\leadsto \mathsf{fma}\left(99 \cdot \left(a \cdot k\right), k, a\right) \]
        13. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\left(a \cdot k\right) \cdot 99, k, a\right) \]
          2. lower-*.f64N/A

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

            \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
          4. lift-*.f6427.0

            \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
        14. Applied rewrites27.0%

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

        if 1.05e201 < m

        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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(k \cdot a\right) \cdot -10 \]
          4. lift-*.f6445.7

            \[\leadsto \left(k \cdot a\right) \cdot -10 \]
        11. Applied rewrites45.7%

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

      Alternative 10: 47.5% accurate, 3.8× speedup?

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

        1. Initial program 99.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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{a}{k \cdot k} \]
          8. lower-*.f6459.4

            \[\leadsto \frac{a}{k \cdot k} \]
        8. Applied rewrites59.4%

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

        if -2.9000000000000001e-108 < m < 2.5

        1. Initial program 95.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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

          if 2.5 < m < 1.05e201

          1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(k \cdot \left(-1 \cdot \left(k \cdot \left(-10 \cdot a + -10 \cdot \left(a + -100 \cdot a\right)\right)\right) - \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
          8. Applied rewrites11.6%

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
            5. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
            6. lift-*.f6427.0

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(k \cdot a, 99, -10 \cdot a\right), k, a\right) \]
          11. Applied rewrites27.0%

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

            \[\leadsto \mathsf{fma}\left(99 \cdot \left(a \cdot k\right), k, a\right) \]
          13. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\left(a \cdot k\right) \cdot 99, k, a\right) \]
            2. lower-*.f64N/A

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

              \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
            4. lift-*.f6427.0

              \[\leadsto \mathsf{fma}\left(\left(k \cdot a\right) \cdot 99, k, a\right) \]
          14. Applied rewrites27.0%

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

          if 1.05e201 < m

          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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(k \cdot a\right) \cdot -10 \]
            4. lift-*.f6445.7

              \[\leadsto \left(k \cdot a\right) \cdot -10 \]
          11. Applied rewrites45.7%

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

        Alternative 11: 24.9% accurate, 7.9× speedup?

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

          1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto a \]
          7. Step-by-step derivation
            1. Applied rewrites23.9%

              \[\leadsto a \]

            if 5.5000000000000006e33 < m

            1. Initial program 79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(k \cdot a\right) \cdot -10 \]
              4. lift-*.f6426.6

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

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

          Alternative 12: 19.8% 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 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. lower-/.f64N/A

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

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

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

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

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

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

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

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

            \[\leadsto a \]
          7. Step-by-step derivation
            1. Applied rewrites17.9%

              \[\leadsto a \]
            2. Add Preprocessing

            Reproduce

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