Falkner and Boettcher, Appendix A

Percentage Accurate: 89.9% → 97.3%
Time: 5.1s
Alternatives: 12
Speedup: 1.1×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 89.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 97.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 96.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000004e-10 < m

    1. Initial program 78.0%

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

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

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

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

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

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

Alternative 2: 96.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.5 \cdot 10^{-8}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{k \cdot k}\\

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

    if -4.49999999999999993e-8 < m < 5.2999999999999998e-11

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

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

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

    if 5.2999999999999998e-11 < m

    1. Initial program 78.0%

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

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

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

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

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

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

Alternative 3: 96.9% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 89.0%

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

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

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

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

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

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

    if -9.7999999999999997e-4 < m < 5.2999999999999998e-11

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 61.2% accurate, 2.2× speedup?

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

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(-100 \cdot \frac{a}{k} + \frac{a}{k}\right) + \left(\mathsf{neg}\left(-10\right)\right) \cdot a}{k}, -1, a\right)}{{k}^{2}} \]
      7. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

    if -68 < m < 1.00000000000000004e-10

    1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000004e-10 < m < 3.0999999999999998e222

    1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, -99 \cdot a, -10 \cdot a\right), k, a\right) \]
      13. lower-*.f6434.8

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

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

    if 3.0999999999999998e222 < m

    1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
        3. distribute-rgt-inN/A

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

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

          \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
        6. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -68:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(-99, \frac{a}{k}, 10 \cdot a\right)}{k}, -1, a\right)}{k \cdot k}\\ \mathbf{elif}\;m \leq 10^{-10}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{elif}\;m \leq 3.1 \cdot 10^{+222}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-k, -99 \cdot a, -10 \cdot a\right), k, a\right)\\ \mathbf{else}:\\ \;\;\;\;\left(k \cdot a\right) \cdot -10\\ \end{array} \]
    10. Add Preprocessing

    Alternative 5: 59.6% accurate, 3.1× speedup?

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

      1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{a}}{k \cdot k} \]
      7. Step-by-step derivation
        1. Applied rewrites48.8%

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

        if -0.220000000000000001 < m < 1.00000000000000004e-10

        1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

        if 1.00000000000000004e-10 < m < 3.0999999999999998e222

        1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-k, -99 \cdot a, -10 \cdot a\right), k, a\right) \]
          13. lower-*.f6434.8

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

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

        if 3.0999999999999998e222 < m

        1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
            3. distribute-rgt-inN/A

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

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

              \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
            6. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(k \cdot a\right) \cdot -10 \]
        8. Recombined 4 regimes into one program.
        9. Final simplification60.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -0.22:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 10^{-10}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\ \mathbf{elif}\;m \leq 3.1 \cdot 10^{+222}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-k, -99 \cdot a, -10 \cdot a\right), k, a\right)\\ \mathbf{else}:\\ \;\;\;\;\left(k \cdot a\right) \cdot -10\\ \end{array} \]
        10. Add Preprocessing

        Alternative 6: 57.8% accurate, 4.1× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{a}}{k \cdot k} \]
          7. Step-by-step derivation
            1. Applied rewrites48.8%

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

            if -0.220000000000000001 < m < 1.69999999999999996

            1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

            if 1.69999999999999996 < m

            1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                3. distribute-rgt-inN/A

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

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

                  \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                6. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 7: 57.1% accurate, 4.5× speedup?

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

              1. Initial program 100.0%

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

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

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

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

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

                \[\leadsto \frac{\color{blue}{a}}{k \cdot k} \]
              7. Step-by-step derivation
                1. Applied rewrites48.8%

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

                if -0.220000000000000001 < m < 1.69999999999999996

                1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

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

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

                  if 1.69999999999999996 < m

                  1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                      3. distribute-rgt-inN/A

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

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

                        \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                      6. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 8: 46.2% accurate, 4.5× speedup?

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

                    1. Initial program 98.0%

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

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

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

                        \[\leadsto \frac{a \cdot {k}^{m}}{k \cdot \color{blue}{k}} \]
                    5. Applied rewrites94.0%

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

                      \[\leadsto \frac{\color{blue}{a}}{k \cdot k} \]
                    7. Step-by-step derivation
                      1. Applied rewrites49.8%

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

                      if -1.99999999999999988e-106 < m < 1.69999999999999996

                      1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

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

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

                        if 1.69999999999999996 < m

                        1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                            3. distribute-rgt-inN/A

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

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

                              \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                            6. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 9: 45.2% accurate, 4.6× speedup?

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

                          1. Initial program 85.8%

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

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

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

                              \[\leadsto \frac{a \cdot {k}^{m}}{k \cdot \color{blue}{k}} \]
                          5. Applied rewrites76.3%

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

                            \[\leadsto \frac{\color{blue}{a}}{k \cdot k} \]
                          7. Step-by-step derivation
                            1. Applied rewrites39.8%

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

                            if 1.07999999999999994e-272 < k < 2.6000000000000001e-11

                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto a \]
                            7. Step-by-step derivation
                              1. Applied rewrites56.4%

                                \[\leadsto a \]
                            8. Recombined 2 regimes into one program.
                            9. Final simplification45.1%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 1.08 \cdot 10^{-272} \lor \neg \left(k \leq 2.6 \cdot 10^{-11}\right):\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
                            10. Add Preprocessing

                            Alternative 10: 31.0% accurate, 5.8× speedup?

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

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{a}{\left(\frac{10}{k} + 1\right) \cdot \left(k \cdot k\right)} \]
                                15. lift-*.f6440.7

                                  \[\leadsto \frac{a}{\left(\frac{10}{k} + 1\right) \cdot \left(k \cdot k\right)} \]
                              8. Applied rewrites40.7%

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

                                \[\leadsto \frac{a}{10 \cdot k} \]
                              10. Step-by-step derivation
                                1. lower-*.f6422.8

                                  \[\leadsto \frac{a}{10 \cdot k} \]
                              11. Applied rewrites22.8%

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

                              if -4.3999999999999997e-8 < m < 0.46999999999999997

                              1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto a \]

                                if 0.46999999999999997 < m

                                1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                                    3. distribute-rgt-inN/A

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

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

                                      \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                                    6. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \left(k \cdot a\right) \cdot -10 \]
                                8. Recombined 3 regimes into one program.
                                9. Final simplification33.5%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -4.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{a}{10 \cdot k}\\ \mathbf{elif}\;m \leq 0.47:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;\left(k \cdot a\right) \cdot -10\\ \end{array} \]
                                10. Add Preprocessing

                                Alternative 11: 25.5% accurate, 7.9× speedup?

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

                                  1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto a \]

                                    if 0.46999999999999997 < m

                                    1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                                        3. distribute-rgt-inN/A

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

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

                                          \[\leadsto a + -10 \cdot \left(a \cdot k\right) \]
                                        6. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq 0.47:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;\left(k \cdot a\right) \cdot -10\\ \end{array} \]
                                    10. Add Preprocessing

                                    Alternative 12: 20.2% accurate, 134.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto a \]
                                      2. Final simplification22.1%

                                        \[\leadsto a \]
                                      3. Add Preprocessing

                                      Reproduce

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