Falkner and Boettcher, Appendix A

Percentage Accurate: 90.5% → 97.5%
Time: 4.4s
Alternatives: 14
Speedup: 1.3×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999992e-12 < m

    1. Initial program 77.8%

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

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

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

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

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

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

Alternative 2: 97.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -1.75 \cdot 10^{-14}:\\ \;\;\;\;\frac{a \cdot {k}^{m}}{k \cdot k}\\ \mathbf{elif}\;m \leq 0.00021:\\ \;\;\;\;\frac{\mathsf{fma}\left(\log k \cdot m, a, a\right)}{\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 -1.75e-14)
   (/ (* a (pow k m)) (* k k))
   (if (<= m 0.00021)
     (/ (fma (* (log k) m) a a) (fma (+ 10.0 k) k 1.0))
     (* (pow k m) a))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -1.75e-14) {
		tmp = (a * pow(k, m)) / (k * k);
	} else if (m <= 0.00021) {
		tmp = fma((log(k) * m), a, 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 <= -1.75e-14)
		tmp = Float64(Float64(a * (k ^ m)) / Float64(k * k));
	elseif (m <= 0.00021)
		tmp = Float64(fma(Float64(log(k) * m), a, 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, -1.75e-14], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.00021], N[(N[(N[(N[Log[k], $MachinePrecision] * m), $MachinePrecision] * a + a), $MachinePrecision] / 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 -1.75 \cdot 10^{-14}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{k \cdot k}\\

\mathbf{elif}\;m \leq 0.00021:\\
\;\;\;\;\frac{\mathsf{fma}\left(\log k \cdot m, a, a\right)}{\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 < -1.7500000000000001e-14

    1. Initial program 99.7%

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

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

        \[\leadsto \frac{a \cdot {k}^{m}}{k \cdot \color{blue}{k}} \]
      2. lift-*.f6498.4

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

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

    if -1.7500000000000001e-14 < m < 2.1000000000000001e-4

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\log k \cdot m, a, a\right)}{\mathsf{fma}\left(10 + k, \color{blue}{k}, 1\right)} \]
      14. lower-+.f6493.9

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

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

    if 2.1000000000000001e-4 < m

    1. Initial program 77.5%

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

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

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

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

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

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

Alternative 3: 97.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {k}^{m} \cdot a\\ \mathbf{if}\;m \leq -8400000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 0.00021:\\ \;\;\;\;\frac{\mathsf{fma}\left(\log k \cdot m, a, a\right)}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (* (pow k m) a)))
   (if (<= m -8400000000.0)
     t_0
     (if (<= m 0.00021)
       (/ (fma (* (log k) m) a a) (fma (+ 10.0 k) k 1.0))
       t_0))))
double code(double a, double k, double m) {
	double t_0 = pow(k, m) * a;
	double tmp;
	if (m <= -8400000000.0) {
		tmp = t_0;
	} else if (m <= 0.00021) {
		tmp = fma((log(k) * m), a, a) / fma((10.0 + k), k, 1.0);
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, k, m)
	t_0 = Float64((k ^ m) * a)
	tmp = 0.0
	if (m <= -8400000000.0)
		tmp = t_0;
	elseif (m <= 0.00021)
		tmp = Float64(fma(Float64(log(k) * m), a, a) / fma(Float64(10.0 + k), k, 1.0));
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -8400000000.0], t$95$0, If[LessEqual[m, 0.00021], N[(N[(N[(N[Log[k], $MachinePrecision] * m), $MachinePrecision] * a + a), $MachinePrecision] / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -8.4e9 or 2.1000000000000001e-4 < m

    1. Initial program 88.5%

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

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

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

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

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

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

    if -8.4e9 < m < 2.1000000000000001e-4

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.7% accurate, 1.3× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -8.4e9 or 3.99999999999999992e-12 < m

    1. Initial program 88.6%

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

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

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

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

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

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

    if -8.4e9 < m < 3.99999999999999992e-12

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 60.9% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if m < -8.4e9

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      3. lift-*.f6462.0

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

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

    if -8.4e9 < m < 5.5e15

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

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

    if 5.5e15 < m

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1 \cdot \left(k \cdot \left(a + -100 \cdot a\right)\right) - 10 \cdot a, k, a\right) \]
      5. mul-1-negN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(-\left(a + -100 \cdot a\right) \cdot k\right) - 10 \cdot a, k, a\right) \]
      9. distribute-rgt1-inN/A

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

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

        \[\leadsto \mathsf{fma}\left(\left(-\left(-99 \cdot a\right) \cdot k\right) - 10 \cdot a, k, a\right) \]
      12. lower-*.f6428.4

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

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

Alternative 6: 54.7% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if m < -8.4e9

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      3. lift-*.f6462.0

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

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

    if -8.4e9 < m < 3.99999999999999992e-12

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999992e-12 < m

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(m \cdot \log k\right) \cdot a + a \]
      4. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\log k \cdot m, a, a\right) \]
      7. lift-log.f649.4

        \[\leadsto \mathsf{fma}\left(\log k \cdot m, a, a\right) \]
    7. Applied rewrites9.4%

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

Alternative 7: 54.5% accurate, 1.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if m < -8.4e9

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      3. lift-*.f6462.0

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

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

    if -8.4e9 < m < 7.20000000000000031e25

    1. Initial program 93.2%

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

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

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

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

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

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

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

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

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

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

    if 7.20000000000000031e25 < m

    1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(m \cdot \log k\right) \cdot a + a \]
      4. lower-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma}\left(\log k \cdot m, a, a\right) \]
      7. lift-log.f649.3

        \[\leadsto \mathsf{fma}\left(\log k \cdot m, a, a\right) \]
    7. Applied rewrites9.3%

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

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

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

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

        \[\leadsto \left(\log k \cdot m\right) \cdot a \]
      4. lift-log.f64N/A

        \[\leadsto \left(\log k \cdot m\right) \cdot a \]
      5. lift-*.f649.3

        \[\leadsto \left(\log k \cdot m\right) \cdot a \]
    10. Applied rewrites9.3%

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

Alternative 8: 47.6% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k}\\


\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))) < 0.0

    1. Initial program 97.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto a \]
    6. Step-by-step derivation
      1. Applied rewrites15.5%

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

        \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
      3. 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. +-commutativeN/A

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

          \[\leadsto \frac{a}{{k}^{2}} \]
        8. lower-/.f64N/A

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

          \[\leadsto \frac{a}{k \cdot k} \]
        10. lift-*.f6440.8

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

        \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{a}{k \cdot k} \]
        2. lift-/.f64N/A

          \[\leadsto \frac{a}{k \cdot \color{blue}{k}} \]
        3. associate-/r*N/A

          \[\leadsto \frac{\frac{a}{k}}{k} \]
        4. lower-/.f64N/A

          \[\leadsto \frac{\frac{a}{k}}{k} \]
        5. lower-/.f6439.5

          \[\leadsto \frac{\frac{a}{k}}{k} \]
      6. Applied rewrites39.5%

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

      if 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1.9999999999999999e305

      1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

      if 1.9999999999999999e305 < (/.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 61.4%

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{a}{k \cdot k} \]
        3. lift-*.f6425.5

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

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

    Alternative 9: 47.5% accurate, 0.4× speedup?

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

      1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
        3. 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. +-commutativeN/A

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

            \[\leadsto \frac{a}{{k}^{2}} \]
          8. lower-/.f64N/A

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

            \[\leadsto \frac{a}{k \cdot k} \]
          10. lift-*.f6440.7

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

          \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
        5. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{a}{k \cdot k} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{a}{k \cdot \color{blue}{k}} \]
          3. associate-/r*N/A

            \[\leadsto \frac{\frac{a}{k}}{k} \]
          4. lower-/.f64N/A

            \[\leadsto \frac{\frac{a}{k}}{k} \]
          5. lower-/.f6439.5

            \[\leadsto \frac{\frac{a}{k}}{k} \]
        6. Applied rewrites39.5%

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

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

        1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

          if 1.9999999999999999e305 < (/.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 61.4%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{a}{k \cdot k} \]
            3. lift-*.f6425.5

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

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

        Alternative 10: 47.3% accurate, 2.0× speedup?

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

          1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1.3199999999999999e-307 < k < 10

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

            if 10 < k

            1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
              3. 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. +-commutativeN/A

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

                  \[\leadsto \frac{a}{{k}^{2}} \]
                8. lower-/.f64N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
              5. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \frac{a}{k \cdot k} \]
                2. lift-/.f64N/A

                  \[\leadsto \frac{a}{k \cdot \color{blue}{k}} \]
                3. associate-/r*N/A

                  \[\leadsto \frac{\frac{a}{k}}{k} \]
                4. lower-/.f64N/A

                  \[\leadsto \frac{\frac{a}{k}}{k} \]
                5. lower-/.f6461.5

                  \[\leadsto \frac{\frac{a}{k}}{k} \]
              6. Applied rewrites61.5%

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

            Alternative 11: 46.4% accurate, 2.1× speedup?

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

              1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 1.3199999999999999e-307 < k < 0.10000000000000001

              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 0.10000000000000001 < k

              1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                3. 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. +-commutativeN/A

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

                    \[\leadsto \frac{a}{{k}^{2}} \]
                  8. lower-/.f64N/A

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

                    \[\leadsto \frac{a}{k \cdot k} \]
                  10. lift-*.f6458.4

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

                  \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
                5. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \frac{a}{k \cdot k} \]
                  2. lift-/.f64N/A

                    \[\leadsto \frac{a}{k \cdot \color{blue}{k}} \]
                  3. associate-/r*N/A

                    \[\leadsto \frac{\frac{a}{k}}{k} \]
                  4. lower-/.f64N/A

                    \[\leadsto \frac{\frac{a}{k}}{k} \]
                  5. lower-/.f6461.2

                    \[\leadsto \frac{\frac{a}{k}}{k} \]
                6. Applied rewrites61.2%

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

              Alternative 12: 43.6% accurate, 2.3× speedup?

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

                1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 1.3199999999999999e-307 < k < 1

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto a \]

                  if 1 < k

                  1. Initial program 81.8%

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{a}{\color{blue}{{k}^{2}}} \]
                    3. 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. +-commutativeN/A

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

                        \[\leadsto \frac{a}{{k}^{2}} \]
                      8. lower-/.f64N/A

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

                        \[\leadsto \frac{a}{k \cdot k} \]
                      10. lift-*.f6458.6

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

                      \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
                    5. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto \frac{a}{k \cdot k} \]
                      2. lift-/.f64N/A

                        \[\leadsto \frac{a}{k \cdot \color{blue}{k}} \]
                      3. associate-/r*N/A

                        \[\leadsto \frac{\frac{a}{k}}{k} \]
                      4. lower-/.f64N/A

                        \[\leadsto \frac{\frac{a}{k}}{k} \]
                      5. lower-/.f6461.4

                        \[\leadsto \frac{\frac{a}{k}}{k} \]
                    6. Applied rewrites61.4%

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

                  Alternative 13: 42.4% accurate, 2.3× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{k \cdot k}\\ \mathbf{if}\;k \leq 1.32 \cdot 10^{-307}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;k \leq 1:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  (FPCore (a k m)
                   :precision binary64
                   (let* ((t_0 (/ a (* k k)))) (if (<= k 1.32e-307) t_0 (if (<= k 1.0) a t_0))))
                  double code(double a, double k, double m) {
                  	double t_0 = a / (k * k);
                  	double tmp;
                  	if (k <= 1.32e-307) {
                  		tmp = t_0;
                  	} else if (k <= 1.0) {
                  		tmp = a;
                  	} else {
                  		tmp = t_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) :: t_0
                      real(8) :: tmp
                      t_0 = a / (k * k)
                      if (k <= 1.32d-307) then
                          tmp = t_0
                      else if (k <= 1.0d0) then
                          tmp = a
                      else
                          tmp = t_0
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double a, double k, double m) {
                  	double t_0 = a / (k * k);
                  	double tmp;
                  	if (k <= 1.32e-307) {
                  		tmp = t_0;
                  	} else if (k <= 1.0) {
                  		tmp = a;
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  def code(a, k, m):
                  	t_0 = a / (k * k)
                  	tmp = 0
                  	if k <= 1.32e-307:
                  		tmp = t_0
                  	elif k <= 1.0:
                  		tmp = a
                  	else:
                  		tmp = t_0
                  	return tmp
                  
                  function code(a, k, m)
                  	t_0 = Float64(a / Float64(k * k))
                  	tmp = 0.0
                  	if (k <= 1.32e-307)
                  		tmp = t_0;
                  	elseif (k <= 1.0)
                  		tmp = a;
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(a, k, m)
                  	t_0 = a / (k * k);
                  	tmp = 0.0;
                  	if (k <= 1.32e-307)
                  		tmp = t_0;
                  	elseif (k <= 1.0)
                  		tmp = a;
                  	else
                  		tmp = t_0;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.32e-307], t$95$0, If[LessEqual[k, 1.0], a, t$95$0]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := \frac{a}{k \cdot k}\\
                  \mathbf{if}\;k \leq 1.32 \cdot 10^{-307}:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;k \leq 1:\\
                  \;\;\;\;a\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if k < 1.3199999999999999e-307 or 1 < k

                    1. Initial program 85.4%

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{a}{k \cdot k} \]
                      3. lift-*.f6445.2

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

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

                    if 1.3199999999999999e-307 < k < 1

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto a \]
                    7. Recombined 2 regimes into one program.
                    8. Add Preprocessing

                    Alternative 14: 19.7% accurate, 34.5× speedup?

                    \[\begin{array}{l} \\ a \end{array} \]
                    (FPCore (a k m) :precision binary64 a)
                    double code(double a, double k, double m) {
                    	return a;
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(a, k, m)
                    use fmin_fmax_functions
                        real(8), intent (in) :: a
                        real(8), intent (in) :: k
                        real(8), intent (in) :: m
                        code = a
                    end function
                    
                    public static double code(double a, double k, double m) {
                    	return a;
                    }
                    
                    def code(a, k, m):
                    	return a
                    
                    function code(a, k, m)
                    	return a
                    end
                    
                    function tmp = code(a, k, m)
                    	tmp = a;
                    end
                    
                    code[a_, k_, m_] := a
                    
                    \begin{array}{l}
                    
                    \\
                    a
                    \end{array}
                    
                    Derivation
                    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto a \]
                    6. Step-by-step derivation
                      1. Applied rewrites19.7%

                        \[\leadsto a \]
                      2. Add Preprocessing

                      Reproduce

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