Falkner and Boettcher, Appendix A

Percentage Accurate: 90.3% → 99.9%
Time: 5.0s
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.3% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.9% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{a}{1 + \frac{k \cdot k}{1 + 10 \cdot k}} \cdot \frac{{k}^{m}}{1 + 10 \cdot k}} \]
      7. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.89999999999999991 < m

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
      2. lower-pow.f6482.5

        \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
    8. Applied rewrites82.5%

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

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

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    10. Applied rewrites82.5%

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

Alternative 2: 99.9% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

    if 3.89999999999999991 < m

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
      2. lower-pow.f6482.5

        \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
    8. Applied rewrites82.5%

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

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

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    10. Applied rewrites82.5%

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

Alternative 3: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {k}^{m} \cdot a\\ \mathbf{if}\;m \leq -1.2 \cdot 10^{-11}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 0.095:\\ \;\;\;\;\frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1} \cdot \frac{1}{1 + 10 \cdot k}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (* (pow k m) a)))
   (if (<= m -1.2e-11)
     t_0
     (if (<= m 0.095)
       (* (/ a (- (/ k (- 10.0 (/ -1.0 k))) -1.0)) (/ 1.0 (+ 1.0 (* 10.0 k))))
       t_0))))
double code(double a, double k, double m) {
	double t_0 = pow(k, m) * a;
	double tmp;
	if (m <= -1.2e-11) {
		tmp = t_0;
	} else if (m <= 0.095) {
		tmp = (a / ((k / (10.0 - (-1.0 / k))) - -1.0)) * (1.0 / (1.0 + (10.0 * k)));
	} 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 = (k ** m) * a
    if (m <= (-1.2d-11)) then
        tmp = t_0
    else if (m <= 0.095d0) then
        tmp = (a / ((k / (10.0d0 - ((-1.0d0) / k))) - (-1.0d0))) * (1.0d0 / (1.0d0 + (10.0d0 * k)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double t_0 = Math.pow(k, m) * a;
	double tmp;
	if (m <= -1.2e-11) {
		tmp = t_0;
	} else if (m <= 0.095) {
		tmp = (a / ((k / (10.0 - (-1.0 / k))) - -1.0)) * (1.0 / (1.0 + (10.0 * k)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, k, m):
	t_0 = math.pow(k, m) * a
	tmp = 0
	if m <= -1.2e-11:
		tmp = t_0
	elif m <= 0.095:
		tmp = (a / ((k / (10.0 - (-1.0 / k))) - -1.0)) * (1.0 / (1.0 + (10.0 * k)))
	else:
		tmp = t_0
	return tmp
function code(a, k, m)
	t_0 = Float64((k ^ m) * a)
	tmp = 0.0
	if (m <= -1.2e-11)
		tmp = t_0;
	elseif (m <= 0.095)
		tmp = Float64(Float64(a / Float64(Float64(k / Float64(10.0 - Float64(-1.0 / k))) - -1.0)) * Float64(1.0 / Float64(1.0 + Float64(10.0 * k))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	t_0 = (k ^ m) * a;
	tmp = 0.0;
	if (m <= -1.2e-11)
		tmp = t_0;
	elseif (m <= 0.095)
		tmp = (a / ((k / (10.0 - (-1.0 / k))) - -1.0)) * (1.0 / (1.0 + (10.0 * k)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -1.2e-11], t$95$0, If[LessEqual[m, 0.095], N[(N[(a / N[(N[(k / N[(10.0 - N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;m \leq 0.095:\\
\;\;\;\;\frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1} \cdot \frac{1}{1 + 10 \cdot k}\\

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


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

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
      2. lower-pow.f6482.5

        \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
    8. Applied rewrites82.5%

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

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

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    10. Applied rewrites82.5%

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

    if -1.2000000000000001e-11 < m < 0.095000000000000001

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1} \cdot \color{blue}{\frac{1}{1 + 10 \cdot k}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1} \cdot \frac{1}{\color{blue}{1 + 10 \cdot k}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1} \cdot \frac{1}{1 + \color{blue}{10 \cdot k}} \]
      3. lower-*.f6444.3

        \[\leadsto \frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1} \cdot \frac{1}{1 + 10 \cdot \color{blue}{k}} \]
    8. Applied rewrites44.3%

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

Alternative 4: 99.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {k}^{m} \cdot a\\ \mathbf{if}\;m \leq -1.2 \cdot 10^{-11}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 0.095:\\ \;\;\;\;\frac{\frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1}}{\mathsf{fma}\left(10, 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 -1.2e-11)
     t_0
     (if (<= m 0.095)
       (/ (/ a (- (/ k (- 10.0 (/ -1.0 k))) -1.0)) (fma 10.0 k 1.0))
       t_0))))
double code(double a, double k, double m) {
	double t_0 = pow(k, m) * a;
	double tmp;
	if (m <= -1.2e-11) {
		tmp = t_0;
	} else if (m <= 0.095) {
		tmp = (a / ((k / (10.0 - (-1.0 / k))) - -1.0)) / fma(10.0, 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 <= -1.2e-11)
		tmp = t_0;
	elseif (m <= 0.095)
		tmp = Float64(Float64(a / Float64(Float64(k / Float64(10.0 - Float64(-1.0 / k))) - -1.0)) / fma(10.0, 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, -1.2e-11], t$95$0, If[LessEqual[m, 0.095], N[(N[(a / N[(N[(k / N[(10.0 - N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
      2. lower-pow.f6482.5

        \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
    8. Applied rewrites82.5%

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

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

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    10. Applied rewrites82.5%

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

    if -1.2000000000000001e-11 < m < 0.095000000000000001

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right) \cdot \left(\color{blue}{1} + 10 \cdot k\right)} \]
      14. associate-/r*N/A

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

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

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

Alternative 5: 99.0% accurate, 0.8× speedup?

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

\\
\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}
\end{array}
Derivation
  1. Initial program 90.3%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
  3. Applied rewrites99.8%

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

Alternative 6: 97.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.5 < m

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
      2. lower-pow.f6482.5

        \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
    8. Applied rewrites82.5%

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

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

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    10. Applied rewrites82.5%

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

Alternative 7: 97.1% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{1 + \frac{k \cdot k}{1 + 10 \cdot k}}}{1 + 10 \cdot k}} \]
    3. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \color{blue}{{k}^{m}} \]
      2. lower-pow.f6482.5

        \[\leadsto a \cdot {k}^{\color{blue}{m}} \]
    8. Applied rewrites82.5%

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

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

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

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

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

        \[\leadsto {k}^{m} \cdot a \]
    10. Applied rewrites82.5%

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

    if -1.2000000000000001e-11 < m < 0.095000000000000001

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 61.9% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-pow.f6435.8

        \[\leadsto \frac{a}{{k}^{2}} \]
    7. Applied rewrites35.8%

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

        \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
      2. lift-pow.f64N/A

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      5. div-flipN/A

        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
      7. lower-/.f6435.8

        \[\leadsto \frac{1}{\frac{k \cdot k}{a}} \]
    9. Applied rewrites35.8%

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

    if -0.299999999999999989 < m < 1.2e5

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2e5 < m

    1. Initial program 90.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{\color{blue}{1 + \mathsf{fma}\left(10, k, {k}^{2}\right)}} \]
      2. div-flipN/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(k, 10 + k, 1\right)}{a}} \]
      11. associate-/r/N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{fma}\left(k - \left(\mathsf{neg}\left(10\right)\right), k, 1\right)} \cdot a \]
      21. metadata-eval44.6

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

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

      \[\leadsto \left(1 + k \cdot \left(99 \cdot k - 10\right)\right) \cdot a \]
    8. Step-by-step derivation
      1. lower-+.f64N/A

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

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

        \[\leadsto \left(1 + k \cdot \left(99 \cdot k - 10\right)\right) \cdot a \]
      4. lower-*.f6428.5

        \[\leadsto \left(1 + k \cdot \left(99 \cdot k - 10\right)\right) \cdot a \]
    9. Applied rewrites28.5%

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

Alternative 9: 54.2% accurate, 1.6× speedup?

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

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-pow.f6435.8

        \[\leadsto \frac{a}{{k}^{2}} \]
    7. Applied rewrites35.8%

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

        \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
      2. lift-pow.f64N/A

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      5. div-flipN/A

        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
      7. lower-/.f6435.8

        \[\leadsto \frac{1}{\frac{k \cdot k}{a}} \]
    9. Applied rewrites35.8%

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

    if -0.299999999999999989 < m < 1.25e16

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.25e16 < m

    1. Initial program 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-+.f64N/A

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

        \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
      3. lower-*.f6420.6

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

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

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

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

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

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

        \[\leadsto -10 \cdot \left(k \cdot a\right) + a \]
      6. associate-*r*N/A

        \[\leadsto \left(-10 \cdot k\right) \cdot a + a \]
      7. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(10\right)\right) \cdot k\right) \cdot a + a \]
      8. distribute-lft-neg-outN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(10 \cdot k\right), a, a\right) \]
      10. distribute-lft-neg-outN/A

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

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

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

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

Alternative 10: 54.2% accurate, 1.8× speedup?

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

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-pow.f6435.8

        \[\leadsto \frac{a}{{k}^{2}} \]
    7. Applied rewrites35.8%

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

        \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
      2. lift-pow.f64N/A

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      5. div-flipN/A

        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{1}{\frac{k \cdot k}{\color{blue}{a}}} \]
      7. lower-/.f6435.8

        \[\leadsto \frac{1}{\frac{k \cdot k}{a}} \]
    9. Applied rewrites35.8%

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

    if -0.299999999999999989 < m < 1.25e16

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{\mathsf{fma}\left(k + 10, k, 1\right)} \]
      12. add-flipN/A

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

        \[\leadsto \frac{a}{\mathsf{fma}\left(k - \left(\mathsf{neg}\left(10\right)\right), k, 1\right)} \]
      14. metadata-eval44.6

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

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

    if 1.25e16 < m

    1. Initial program 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-+.f64N/A

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

        \[\leadsto a + -10 \cdot \left(a \cdot \color{blue}{k}\right) \]
      3. lower-*.f6420.6

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

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

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

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

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

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

        \[\leadsto -10 \cdot \left(k \cdot a\right) + a \]
      6. associate-*r*N/A

        \[\leadsto \left(-10 \cdot k\right) \cdot a + a \]
      7. metadata-evalN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(10\right)\right) \cdot k\right) \cdot a + a \]
      8. distribute-lft-neg-outN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(10 \cdot k\right), a, a\right) \]
      10. distribute-lft-neg-outN/A

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

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

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

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

Alternative 11: 40.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{k \cdot k}\\ t_1 := 1 + 10 \cdot k\\ t_2 := \frac{a \cdot {k}^{m}}{t\_1 + k \cdot k}\\ \mathbf{if}\;t\_2 \leq 10^{-317}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+291}:\\ \;\;\;\;\frac{a}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (/ a (* k k)))
        (t_1 (+ 1.0 (* 10.0 k)))
        (t_2 (/ (* a (pow k m)) (+ t_1 (* k k)))))
   (if (<= t_2 1e-317) t_0 (if (<= t_2 4e+291) (/ a t_1) t_0))))
double code(double a, double k, double m) {
	double t_0 = a / (k * k);
	double t_1 = 1.0 + (10.0 * k);
	double t_2 = (a * pow(k, m)) / (t_1 + (k * k));
	double tmp;
	if (t_2 <= 1e-317) {
		tmp = t_0;
	} else if (t_2 <= 4e+291) {
		tmp = a / t_1;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = a / (k * k)
    t_1 = 1.0d0 + (10.0d0 * k)
    t_2 = (a * (k ** m)) / (t_1 + (k * k))
    if (t_2 <= 1d-317) then
        tmp = t_0
    else if (t_2 <= 4d+291) then
        tmp = a / t_1
    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 t_1 = 1.0 + (10.0 * k);
	double t_2 = (a * Math.pow(k, m)) / (t_1 + (k * k));
	double tmp;
	if (t_2 <= 1e-317) {
		tmp = t_0;
	} else if (t_2 <= 4e+291) {
		tmp = a / t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, k, m):
	t_0 = a / (k * k)
	t_1 = 1.0 + (10.0 * k)
	t_2 = (a * math.pow(k, m)) / (t_1 + (k * k))
	tmp = 0
	if t_2 <= 1e-317:
		tmp = t_0
	elif t_2 <= 4e+291:
		tmp = a / t_1
	else:
		tmp = t_0
	return tmp
function code(a, k, m)
	t_0 = Float64(a / Float64(k * k))
	t_1 = Float64(1.0 + Float64(10.0 * k))
	t_2 = Float64(Float64(a * (k ^ m)) / Float64(t_1 + Float64(k * k)))
	tmp = 0.0
	if (t_2 <= 1e-317)
		tmp = t_0;
	elseif (t_2 <= 4e+291)
		tmp = Float64(a / t_1);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	t_0 = a / (k * k);
	t_1 = 1.0 + (10.0 * k);
	t_2 = (a * (k ^ m)) / (t_1 + (k * k));
	tmp = 0.0;
	if (t_2 <= 1e-317)
		tmp = t_0;
	elseif (t_2 <= 4e+291)
		tmp = a / t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e-317], t$95$0, If[LessEqual[t$95$2, 4e+291], N[(a / t$95$1), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
t_1 := 1 + 10 \cdot k\\
t_2 := \frac{a \cdot {k}^{m}}{t\_1 + k \cdot k}\\
\mathbf{if}\;t\_2 \leq 10^{-317}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+291}:\\
\;\;\;\;\frac{a}{t\_1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1.00000023e-317 or 3.9999999999999998e291 < (/.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 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-pow.f6435.8

        \[\leadsto \frac{a}{{k}^{2}} \]
    7. Applied rewrites35.8%

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

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
    9. Applied rewrites35.8%

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

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

    1. Initial program 90.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{1 + 10 \cdot \color{blue}{k}} \]
    6. Step-by-step derivation
      1. lower-*.f6427.9

        \[\leadsto \frac{a}{1 + 10 \cdot k} \]
    7. Applied rewrites27.9%

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

Alternative 12: 40.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 10 \cdot k\\ t_1 := \frac{a \cdot {k}^{m}}{t\_0 + k \cdot k}\\ \mathbf{if}\;t\_1 \leq 10^{-317}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+291}:\\ \;\;\;\;\frac{a}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{k \cdot k} \cdot a\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 10.0 k))) (t_1 (/ (* a (pow k m)) (+ t_0 (* k k)))))
   (if (<= t_1 1e-317)
     (/ a (* k k))
     (if (<= t_1 4e+291) (/ a t_0) (* (/ 1.0 (* k k)) a)))))
double code(double a, double k, double m) {
	double t_0 = 1.0 + (10.0 * k);
	double t_1 = (a * pow(k, m)) / (t_0 + (k * k));
	double tmp;
	if (t_1 <= 1e-317) {
		tmp = a / (k * k);
	} else if (t_1 <= 4e+291) {
		tmp = a / t_0;
	} else {
		tmp = (1.0 / (k * k)) * a;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+291}:\\
\;\;\;\;\frac{a}{t\_0}\\

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


\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))) < 1.00000023e-317

    1. Initial program 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-pow.f6435.8

        \[\leadsto \frac{a}{{k}^{2}} \]
    7. Applied rewrites35.8%

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

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
    9. Applied rewrites35.8%

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

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

    1. Initial program 90.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{1 + 10 \cdot \color{blue}{k}} \]
    6. Step-by-step derivation
      1. lower-*.f6427.9

        \[\leadsto \frac{a}{1 + 10 \cdot k} \]
    7. Applied rewrites27.9%

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

    if 3.9999999999999998e291 < (/.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 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-pow.f6435.8

        \[\leadsto \frac{a}{{k}^{2}} \]
    7. Applied rewrites35.8%

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

        \[\leadsto \frac{a}{{k}^{\color{blue}{2}}} \]
      2. lift-pow.f64N/A

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
      5. div-flipN/A

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

        \[\leadsto \frac{1}{k \cdot k} \cdot a \]
      7. metadata-evalN/A

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

        \[\leadsto \frac{-1 \cdot -1}{k \cdot k} \cdot a \]
      9. frac-timesN/A

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

        \[\leadsto \left(\frac{-1}{k} \cdot \frac{-1}{k}\right) \cdot a \]
      11. lift-/.f64N/A

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

        \[\leadsto \left(\frac{-1}{k} \cdot \frac{-1}{k}\right) \cdot a \]
      13. lift-/.f64N/A

        \[\leadsto \left(\frac{-1}{k} \cdot \frac{-1}{k}\right) \cdot a \]
      14. lift-/.f64N/A

        \[\leadsto \left(\frac{-1}{k} \cdot \frac{-1}{k}\right) \cdot a \]
      15. frac-timesN/A

        \[\leadsto \frac{-1 \cdot -1}{k \cdot k} \cdot a \]
      16. metadata-evalN/A

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

        \[\leadsto \frac{1}{k \cdot k} \cdot a \]
      18. lower-/.f6435.9

        \[\leadsto \frac{1}{k \cdot k} \cdot a \]
    9. Applied rewrites35.9%

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

Alternative 13: 40.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{k \cdot k}\\ t_1 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\ \mathbf{if}\;t\_1 \leq 10^{-317}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+291}:\\ \;\;\;\;\frac{a}{1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (/ a (* k k)))
        (t_1 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
   (if (<= t_1 1e-317) t_0 (if (<= t_1 4e+291) (/ a 1.0) t_0))))
double code(double a, double k, double m) {
	double t_0 = a / (k * k);
	double t_1 = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
	double tmp;
	if (t_1 <= 1e-317) {
		tmp = t_0;
	} else if (t_1 <= 4e+291) {
		tmp = a / 1.0;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = a / (k * k)
    t_1 = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
    if (t_1 <= 1d-317) then
        tmp = t_0
    else if (t_1 <= 4d+291) then
        tmp = a / 1.0d0
    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 t_1 = (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
	double tmp;
	if (t_1 <= 1e-317) {
		tmp = t_0;
	} else if (t_1 <= 4e+291) {
		tmp = a / 1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, k, m):
	t_0 = a / (k * k)
	t_1 = (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
	tmp = 0
	if t_1 <= 1e-317:
		tmp = t_0
	elif t_1 <= 4e+291:
		tmp = a / 1.0
	else:
		tmp = t_0
	return tmp
function code(a, k, m)
	t_0 = Float64(a / Float64(k * k))
	t_1 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
	tmp = 0.0
	if (t_1 <= 1e-317)
		tmp = t_0;
	elseif (t_1 <= 4e+291)
		tmp = Float64(a / 1.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	t_0 = a / (k * k);
	t_1 = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
	tmp = 0.0;
	if (t_1 <= 1e-317)
		tmp = t_0;
	elseif (t_1 <= 4e+291)
		tmp = a / 1.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-317], t$95$0, If[LessEqual[t$95$1, 4e+291], N[(a / 1.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+291}:\\
\;\;\;\;\frac{a}{1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1.00000023e-317 or 3.9999999999999998e291 < (/.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 90.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \mathsf{fma}\left(10, k, {k}^{2}\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. lower-pow.f6435.8

        \[\leadsto \frac{a}{{k}^{2}} \]
    7. Applied rewrites35.8%

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

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

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

        \[\leadsto \frac{a}{k \cdot k} \]
    9. Applied rewrites35.8%

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

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

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{1} \]
    8. Step-by-step derivation
      1. Applied rewrites19.6%

        \[\leadsto \frac{a}{1} \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 14: 19.6% accurate, 7.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{1} \]
    8. Step-by-step derivation
      1. Applied rewrites19.6%

        \[\leadsto \frac{a}{1} \]
      2. Add Preprocessing

      Reproduce

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