Falkner and Boettcher, Appendix A

Percentage Accurate: 90.1% → 97.6%
Time: 13.7s
Alternatives: 11
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));
}
real(8) function code(a, k, m)
    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 11 alternatives:

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

Initial Program: 90.1% 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));
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
	return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m):
	return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function tmp = code(a, k, m)
	tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k));
end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 97.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot {k}^{m}\\ t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{+162}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k)))))
   (if (<= t_1 2e+162) t_1 t_0)))
double code(double a, double k, double m) {
	double t_0 = a * pow(k, m);
	double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
	double tmp;
	if (t_1 <= 2e+162) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = a * (k ** m)
    t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
    if (t_1 <= 2d+162) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double t_0 = a * Math.pow(k, m);
	double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
	double tmp;
	if (t_1 <= 2e+162) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, k, m):
	t_0 = a * math.pow(k, m)
	t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k))
	tmp = 0
	if t_1 <= 2e+162:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(a, k, m)
	t_0 = Float64(a * (k ^ m))
	t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k)))
	tmp = 0.0
	if (t_1 <= 2e+162)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	t_0 = a * (k ^ m);
	t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
	tmp = 0.0;
	if (t_1 <= 2e+162)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+162], t$95$1, t$95$0]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 1.9999999999999999e162

    1. Initial program 98.6%

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

    if 1.9999999999999999e162 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))

    1. Initial program 67.9%

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+162}:\\ \;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a \cdot {k}^{m}\\ \end{array} \]

Alternative 2: 97.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -5.2 \cdot 10^{-17} \lor \neg \left(m \leq 4.8 \cdot 10^{-13}\right):\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (or (<= m -5.2e-17) (not (<= m 4.8e-13)))
   (* a (pow k m))
   (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
	double tmp;
	if ((m <= -5.2e-17) || !(m <= 4.8e-13)) {
		tmp = a * pow(k, m);
	} else {
		tmp = a / (1.0 + (k * (k + 10.0)));
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if ((m <= (-5.2d-17)) .or. (.not. (m <= 4.8d-13))) then
        tmp = a * (k ** m)
    else
        tmp = a / (1.0d0 + (k * (k + 10.0d0)))
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if ((m <= -5.2e-17) || !(m <= 4.8e-13)) {
		tmp = a * Math.pow(k, m);
	} else {
		tmp = a / (1.0 + (k * (k + 10.0)));
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if (m <= -5.2e-17) or not (m <= 4.8e-13):
		tmp = a * math.pow(k, m)
	else:
		tmp = a / (1.0 + (k * (k + 10.0)))
	return tmp
function code(a, k, m)
	tmp = 0.0
	if ((m <= -5.2e-17) || !(m <= 4.8e-13))
		tmp = Float64(a * (k ^ m));
	else
		tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0))));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if ((m <= -5.2e-17) || ~((m <= 4.8e-13)))
		tmp = a * (k ^ m);
	else
		tmp = a / (1.0 + (k * (k + 10.0)));
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[Or[LessEqual[m, -5.2e-17], N[Not[LessEqual[m, 4.8e-13]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.2 \cdot 10^{-17} \lor \neg \left(m \leq 4.8 \cdot 10^{-13}\right):\\
\;\;\;\;a \cdot {k}^{m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -5.20000000000000006e-17 or 4.7999999999999997e-13 < m

    1. Initial program 89.6%

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

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

    if -5.20000000000000006e-17 < m < 4.7999999999999997e-13

    1. Initial program 96.6%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Step-by-step derivation
      1. *-commutative96.6%

        \[\leadsto \frac{\color{blue}{{k}^{m} \cdot a}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      2. add-sqr-sqrt96.6%

        \[\leadsto \frac{{k}^{m} \cdot a}{\color{blue}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      3. times-frac96.6%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      4. associate-+l+96.6%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      5. +-commutative96.6%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      6. distribute-rgt-out96.6%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      7. fma-def96.6%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\mathsf{fma}\left(k, 10 + k, 1\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      8. associate-+l+96.6%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \]
      9. +-commutative96.6%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \]
      10. distribute-rgt-out96.6%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \]
      11. fma-def96.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -5.2 \cdot 10^{-17} \lor \neg \left(m \leq 4.8 \cdot 10^{-13}\right):\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \end{array} \]

Alternative 3: 58.6% accurate, 8.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.94:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 66000000:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= m -0.94)
   (/ a (* k k))
   (if (<= m 66000000.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -0.94) {
		tmp = a / (k * k);
	} else if (m <= 66000000.0) {
		tmp = a / (1.0 + (k * (k + 10.0)));
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= (-0.94d0)) then
        tmp = a / (k * k)
    else if (m <= 66000000.0d0) then
        tmp = a / (1.0d0 + (k * (k + 10.0d0)))
    else
        tmp = (-10.0d0) * (a * k)
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= -0.94) {
		tmp = a / (k * k);
	} else if (m <= 66000000.0) {
		tmp = a / (1.0 + (k * (k + 10.0)));
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= -0.94:
		tmp = a / (k * k)
	elif m <= 66000000.0:
		tmp = a / (1.0 + (k * (k + 10.0)))
	else:
		tmp = -10.0 * (a * k)
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= -0.94)
		tmp = Float64(a / Float64(k * k));
	elseif (m <= 66000000.0)
		tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0))));
	else
		tmp = Float64(-10.0 * Float64(a * k));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= -0.94)
		tmp = a / (k * k);
	elseif (m <= 66000000.0)
		tmp = a / (1.0 + (k * (k + 10.0)));
	else
		tmp = -10.0 * (a * k);
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, -0.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 66000000.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;m \leq 66000000:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    5. Simplified59.2%

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

    if -0.93999999999999995 < m < 6.6e7

    1. Initial program 96.8%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Step-by-step derivation
      1. *-commutative96.8%

        \[\leadsto \frac{\color{blue}{{k}^{m} \cdot a}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      2. add-sqr-sqrt96.7%

        \[\leadsto \frac{{k}^{m} \cdot a}{\color{blue}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      3. times-frac96.8%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      4. associate-+l+96.8%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      5. +-commutative96.8%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      6. distribute-rgt-out96.8%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      7. fma-def96.8%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\mathsf{fma}\left(k, 10 + k, 1\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      8. associate-+l+96.8%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \]
      9. +-commutative96.8%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \]
      10. distribute-rgt-out96.8%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \]
      11. fma-def96.8%

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

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

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

    if 6.6e7 < m

    1. Initial program 79.3%

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

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
    3. Taylor expanded in m around 0 48.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} + a \cdot {k}^{m} \]
    4. Step-by-step derivation
      1. associate-*r*48.0%

        \[\leadsto \color{blue}{\left(-10 \cdot a\right) \cdot k} + a \cdot {k}^{m} \]
      2. *-commutative48.0%

        \[\leadsto \color{blue}{\left(a \cdot -10\right)} \cdot k + a \cdot {k}^{m} \]
    5. Simplified48.0%

      \[\leadsto \color{blue}{\left(a \cdot -10\right) \cdot k} + a \cdot {k}^{m} \]
    6. Taylor expanded in k around inf 18.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -0.94:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 66000000:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \]

Alternative 4: 47.0% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 5.2 \cdot 10^{-295} \lor \neg \left(k \leq 0.23\right):\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (or (<= k 5.2e-295) (not (<= k 0.23)))
   (/ a (* k k))
   (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
	double tmp;
	if ((k <= 5.2e-295) || !(k <= 0.23)) {
		tmp = a / (k * k);
	} else {
		tmp = a + (-10.0 * (a * k));
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if ((k <= 5.2d-295) .or. (.not. (k <= 0.23d0))) then
        tmp = a / (k * k)
    else
        tmp = a + ((-10.0d0) * (a * k))
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if ((k <= 5.2e-295) || !(k <= 0.23)) {
		tmp = a / (k * k);
	} else {
		tmp = a + (-10.0 * (a * k));
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if (k <= 5.2e-295) or not (k <= 0.23):
		tmp = a / (k * k)
	else:
		tmp = a + (-10.0 * (a * k))
	return tmp
function code(a, k, m)
	tmp = 0.0
	if ((k <= 5.2e-295) || !(k <= 0.23))
		tmp = Float64(a / Float64(k * k));
	else
		tmp = Float64(a + Float64(-10.0 * Float64(a * k)));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if ((k <= 5.2e-295) || ~((k <= 0.23)))
		tmp = a / (k * k);
	else
		tmp = a + (-10.0 * (a * k));
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[Or[LessEqual[k, 5.2e-295], N[Not[LessEqual[k, 0.23]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.2 \cdot 10^{-295} \lor \neg \left(k \leq 0.23\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 5.1999999999999997e-295 or 0.23000000000000001 < k

    1. Initial program 88.1%

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

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

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

        \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    5. Simplified41.5%

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

    if 5.1999999999999997e-295 < k < 0.23000000000000001

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{a + -10 \cdot \left(a \cdot k\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 5.2 \cdot 10^{-295} \lor \neg \left(k \leq 0.23\right):\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\ \end{array} \]

Alternative 5: 47.2% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 2.55 \cdot 10^{-294}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 0.075:\\ \;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= k 2.55e-294)
   (/ a (* k k))
   (if (<= k 0.075) (+ a (* -10.0 (* a k))) (/ a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
	double tmp;
	if (k <= 2.55e-294) {
		tmp = a / (k * k);
	} else if (k <= 0.075) {
		tmp = a + (-10.0 * (a * k));
	} else {
		tmp = a / (k * (k + 10.0));
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if (k <= 2.55d-294) then
        tmp = a / (k * k)
    else if (k <= 0.075d0) then
        tmp = a + ((-10.0d0) * (a * k))
    else
        tmp = a / (k * (k + 10.0d0))
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (k <= 2.55e-294) {
		tmp = a / (k * k);
	} else if (k <= 0.075) {
		tmp = a + (-10.0 * (a * k));
	} else {
		tmp = a / (k * (k + 10.0));
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if k <= 2.55e-294:
		tmp = a / (k * k)
	elif k <= 0.075:
		tmp = a + (-10.0 * (a * k))
	else:
		tmp = a / (k * (k + 10.0))
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (k <= 2.55e-294)
		tmp = Float64(a / Float64(k * k));
	elseif (k <= 0.075)
		tmp = Float64(a + Float64(-10.0 * Float64(a * k)));
	else
		tmp = Float64(a / Float64(k * Float64(k + 10.0)));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (k <= 2.55e-294)
		tmp = a / (k * k);
	elseif (k <= 0.075)
		tmp = a + (-10.0 * (a * k));
	else
		tmp = a / (k * (k + 10.0));
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[k, 2.55e-294], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.55 \cdot 10^{-294}:\\
\;\;\;\;\frac{a}{k \cdot k}\\

\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if k < 2.55000000000000003e-294

    1. Initial program 89.6%

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

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

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

        \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    5. Simplified22.1%

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

    if 2.55000000000000003e-294 < k < 0.0749999999999999972

    1. Initial program 99.9%

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

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

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

    if 0.0749999999999999972 < k

    1. Initial program 86.6%

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

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

      \[\leadsto \frac{a}{\color{blue}{10 \cdot k + {k}^{2}}} \]
    4. Step-by-step derivation
      1. unpow265.0%

        \[\leadsto \frac{a}{10 \cdot k + \color{blue}{k \cdot k}} \]
      2. distribute-rgt-in65.0%

        \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right)}} \]
      3. +-commutative65.0%

        \[\leadsto \frac{a}{k \cdot \color{blue}{\left(k + 10\right)}} \]
    5. Simplified65.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 2.55 \cdot 10^{-294}:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 0.075:\\ \;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\ \end{array} \]

Alternative 6: 48.4% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.94:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 66000000:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= m -0.94)
   (/ a (* k k))
   (if (<= m 66000000.0) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -0.94) {
		tmp = a / (k * k);
	} else if (m <= 66000000.0) {
		tmp = a / (1.0 + (k * 10.0));
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= (-0.94d0)) then
        tmp = a / (k * k)
    else if (m <= 66000000.0d0) then
        tmp = a / (1.0d0 + (k * 10.0d0))
    else
        tmp = (-10.0d0) * (a * k)
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= -0.94) {
		tmp = a / (k * k);
	} else if (m <= 66000000.0) {
		tmp = a / (1.0 + (k * 10.0));
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= -0.94:
		tmp = a / (k * k)
	elif m <= 66000000.0:
		tmp = a / (1.0 + (k * 10.0))
	else:
		tmp = -10.0 * (a * k)
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= -0.94)
		tmp = Float64(a / Float64(k * k));
	elseif (m <= 66000000.0)
		tmp = Float64(a / Float64(1.0 + Float64(k * 10.0)));
	else
		tmp = Float64(-10.0 * Float64(a * k));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= -0.94)
		tmp = a / (k * k);
	elseif (m <= 66000000.0)
		tmp = a / (1.0 + (k * 10.0));
	else
		tmp = -10.0 * (a * k);
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, -0.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 66000000.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    5. Simplified59.2%

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

    if -0.93999999999999995 < m < 6.6e7

    1. Initial program 96.8%

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

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1 + 10 \cdot k}} \]
    3. Taylor expanded in m around 0 67.1%

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

    if 6.6e7 < m

    1. Initial program 79.3%

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

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
    3. Taylor expanded in m around 0 48.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} + a \cdot {k}^{m} \]
    4. Step-by-step derivation
      1. associate-*r*48.0%

        \[\leadsto \color{blue}{\left(-10 \cdot a\right) \cdot k} + a \cdot {k}^{m} \]
      2. *-commutative48.0%

        \[\leadsto \color{blue}{\left(a \cdot -10\right)} \cdot k + a \cdot {k}^{m} \]
    5. Simplified48.0%

      \[\leadsto \color{blue}{\left(a \cdot -10\right) \cdot k} + a \cdot {k}^{m} \]
    6. Taylor expanded in k around inf 18.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -0.94:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 66000000:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \]

Alternative 7: 57.9% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.94:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 165000000000:\\ \;\;\;\;\frac{a}{1 + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= m -0.94)
   (/ a (* k k))
   (if (<= m 165000000000.0) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -0.94) {
		tmp = a / (k * k);
	} else if (m <= 165000000000.0) {
		tmp = a / (1.0 + (k * k));
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= (-0.94d0)) then
        tmp = a / (k * k)
    else if (m <= 165000000000.0d0) then
        tmp = a / (1.0d0 + (k * k))
    else
        tmp = (-10.0d0) * (a * k)
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= -0.94) {
		tmp = a / (k * k);
	} else if (m <= 165000000000.0) {
		tmp = a / (1.0 + (k * k));
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= -0.94:
		tmp = a / (k * k)
	elif m <= 165000000000.0:
		tmp = a / (1.0 + (k * k))
	else:
		tmp = -10.0 * (a * k)
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= -0.94)
		tmp = Float64(a / Float64(k * k));
	elseif (m <= 165000000000.0)
		tmp = Float64(a / Float64(1.0 + Float64(k * k)));
	else
		tmp = Float64(-10.0 * Float64(a * k));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= -0.94)
		tmp = a / (k * k);
	elseif (m <= 165000000000.0)
		tmp = a / (1.0 + (k * k));
	else
		tmp = -10.0 * (a * k);
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, -0.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 165000000000.0], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;m \leq 165000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    5. Simplified59.2%

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

    if -0.93999999999999995 < m < 1.65e11

    1. Initial program 96.8%

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

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

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

    if 1.65e11 < m

    1. Initial program 79.3%

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

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
    3. Taylor expanded in m around 0 48.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} + a \cdot {k}^{m} \]
    4. Step-by-step derivation
      1. associate-*r*48.0%

        \[\leadsto \color{blue}{\left(-10 \cdot a\right) \cdot k} + a \cdot {k}^{m} \]
      2. *-commutative48.0%

        \[\leadsto \color{blue}{\left(a \cdot -10\right)} \cdot k + a \cdot {k}^{m} \]
    5. Simplified48.0%

      \[\leadsto \color{blue}{\left(a \cdot -10\right) \cdot k} + a \cdot {k}^{m} \]
    6. Taylor expanded in k around inf 18.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification55.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -0.94:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;m \leq 165000000000:\\ \;\;\;\;\frac{a}{1 + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \]

Alternative 8: 46.8% accurate, 12.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 4.3 \cdot 10^{-294} \lor \neg \left(k \leq 1\right):\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (or (<= k 4.3e-294) (not (<= k 1.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
	double tmp;
	if ((k <= 4.3e-294) || !(k <= 1.0)) {
		tmp = a / (k * k);
	} else {
		tmp = a;
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if ((k <= 4.3d-294) .or. (.not. (k <= 1.0d0))) 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 <= 4.3e-294) || !(k <= 1.0)) {
		tmp = a / (k * k);
	} else {
		tmp = a;
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if (k <= 4.3e-294) or not (k <= 1.0):
		tmp = a / (k * k)
	else:
		tmp = a
	return tmp
function code(a, k, m)
	tmp = 0.0
	if ((k <= 4.3e-294) || !(k <= 1.0))
		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 <= 4.3e-294) || ~((k <= 1.0)))
		tmp = a / (k * k);
	else
		tmp = a;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[Or[LessEqual[k, 4.3e-294], N[Not[LessEqual[k, 1.0]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.3 \cdot 10^{-294} \lor \neg \left(k \leq 1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\

\mathbf{else}:\\
\;\;\;\;a\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 4.30000000000000019e-294 or 1 < k

    1. Initial program 88.1%

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

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

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

        \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    5. Simplified41.5%

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

    if 4.30000000000000019e-294 < k < 1

    1. Initial program 99.9%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto \frac{\color{blue}{{k}^{m} \cdot a}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      2. add-sqr-sqrt99.9%

        \[\leadsto \frac{{k}^{m} \cdot a}{\color{blue}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      3. times-frac99.9%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      4. associate-+l+99.9%

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

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      6. distribute-rgt-out99.9%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      7. fma-def99.9%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\mathsf{fma}\left(k, 10 + k, 1\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      8. associate-+l+99.9%

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

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \]
      10. distribute-rgt-out99.9%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \]
      11. fma-def99.9%

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

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

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

      \[\leadsto \color{blue}{a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 4.3 \cdot 10^{-294} \lor \neg \left(k \leq 1\right):\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]

Alternative 9: 30.8% accurate, 12.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -8.5 \cdot 10^{-61}:\\ \;\;\;\;\frac{a}{k \cdot 10}\\ \mathbf{elif}\;m \leq 66000000:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= m -8.5e-61)
   (/ a (* k 10.0))
   (if (<= m 66000000.0) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -8.5e-61) {
		tmp = a / (k * 10.0);
	} else if (m <= 66000000.0) {
		tmp = a;
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= (-8.5d-61)) then
        tmp = a / (k * 10.0d0)
    else if (m <= 66000000.0d0) then
        tmp = a
    else
        tmp = (-10.0d0) * (a * k)
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= -8.5e-61) {
		tmp = a / (k * 10.0);
	} else if (m <= 66000000.0) {
		tmp = a;
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= -8.5e-61:
		tmp = a / (k * 10.0)
	elif m <= 66000000.0:
		tmp = a
	else:
		tmp = -10.0 * (a * k)
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= -8.5e-61)
		tmp = Float64(a / Float64(k * 10.0));
	elseif (m <= 66000000.0)
		tmp = a;
	else
		tmp = Float64(-10.0 * Float64(a * k));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= -8.5e-61)
		tmp = a / (k * 10.0);
	elseif (m <= 66000000.0)
		tmp = a;
	else
		tmp = -10.0 * (a * k);
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, -8.5e-61], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 66000000.0], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;m \leq 66000000:\\
\;\;\;\;a\\

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


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

    1. Initial program 98.9%

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

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

      \[\leadsto \frac{a}{\color{blue}{10 \cdot k + {k}^{2}}} \]
    4. Step-by-step derivation
      1. unpow240.3%

        \[\leadsto \frac{a}{10 \cdot k + \color{blue}{k \cdot k}} \]
      2. distribute-rgt-in40.3%

        \[\leadsto \frac{a}{\color{blue}{k \cdot \left(10 + k\right)}} \]
      3. +-commutative40.3%

        \[\leadsto \frac{a}{k \cdot \color{blue}{\left(k + 10\right)}} \]
    5. Simplified40.3%

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

      \[\leadsto \frac{a}{\color{blue}{10 \cdot k}} \]
    7. Step-by-step derivation
      1. *-commutative19.9%

        \[\leadsto \frac{a}{\color{blue}{k \cdot 10}} \]
    8. Simplified19.9%

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

    if -8.50000000000000016e-61 < m < 6.6e7

    1. Initial program 97.7%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto \frac{\color{blue}{{k}^{m} \cdot a}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      2. add-sqr-sqrt97.6%

        \[\leadsto \frac{{k}^{m} \cdot a}{\color{blue}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      3. times-frac97.7%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      4. associate-+l+97.7%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      5. +-commutative97.7%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      6. distribute-rgt-out97.7%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      7. fma-def97.7%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\mathsf{fma}\left(k, 10 + k, 1\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      8. associate-+l+97.7%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \]
      9. +-commutative97.7%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \]
      10. distribute-rgt-out97.7%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \]
      11. fma-def97.7%

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

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

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

      \[\leadsto \color{blue}{a} \]

    if 6.6e7 < m

    1. Initial program 79.3%

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

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
    3. Taylor expanded in m around 0 48.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} + a \cdot {k}^{m} \]
    4. Step-by-step derivation
      1. associate-*r*48.0%

        \[\leadsto \color{blue}{\left(-10 \cdot a\right) \cdot k} + a \cdot {k}^{m} \]
      2. *-commutative48.0%

        \[\leadsto \color{blue}{\left(a \cdot -10\right)} \cdot k + a \cdot {k}^{m} \]
    5. Simplified48.0%

      \[\leadsto \color{blue}{\left(a \cdot -10\right) \cdot k} + a \cdot {k}^{m} \]
    6. Taylor expanded in k around inf 18.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification30.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -8.5 \cdot 10^{-61}:\\ \;\;\;\;\frac{a}{k \cdot 10}\\ \mathbf{elif}\;m \leq 66000000:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \]

Alternative 10: 25.6% accurate, 16.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 66000000:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \end{array} \]
(FPCore (a k m) :precision binary64 (if (<= m 66000000.0) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= 66000000.0) {
		tmp = a;
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= 66000000.0d0) then
        tmp = a
    else
        tmp = (-10.0d0) * (a * k)
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= 66000000.0) {
		tmp = a;
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= 66000000.0:
		tmp = a
	else:
		tmp = -10.0 * (a * k)
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= 66000000.0)
		tmp = a;
	else
		tmp = Float64(-10.0 * Float64(a * k));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= 66000000.0)
		tmp = a;
	else
		tmp = -10.0 * (a * k);
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, 66000000.0], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq 66000000:\\
\;\;\;\;a\\

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


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

    1. Initial program 98.3%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Step-by-step derivation
      1. *-commutative98.3%

        \[\leadsto \frac{\color{blue}{{k}^{m} \cdot a}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
      2. add-sqr-sqrt98.3%

        \[\leadsto \frac{{k}^{m} \cdot a}{\color{blue}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      3. times-frac98.3%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
      4. associate-+l+98.3%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      5. +-commutative98.3%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      6. distribute-rgt-out98.3%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      7. fma-def98.3%

        \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\mathsf{fma}\left(k, 10 + k, 1\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      8. associate-+l+98.3%

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

        \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \]
      10. distribute-rgt-out98.3%

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

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

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

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

      \[\leadsto \color{blue}{a} \]

    if 6.6e7 < m

    1. Initial program 79.3%

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

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot \left(k \cdot {k}^{m}\right)\right) + a \cdot {k}^{m}} \]
    3. Taylor expanded in m around 0 48.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} + a \cdot {k}^{m} \]
    4. Step-by-step derivation
      1. associate-*r*48.0%

        \[\leadsto \color{blue}{\left(-10 \cdot a\right) \cdot k} + a \cdot {k}^{m} \]
      2. *-commutative48.0%

        \[\leadsto \color{blue}{\left(a \cdot -10\right)} \cdot k + a \cdot {k}^{m} \]
    5. Simplified48.0%

      \[\leadsto \color{blue}{\left(a \cdot -10\right) \cdot k} + a \cdot {k}^{m} \]
    6. Taylor expanded in k around inf 18.0%

      \[\leadsto \color{blue}{-10 \cdot \left(a \cdot k\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification25.7%

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

Alternative 11: 20.2% accurate, 114.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;
}
real(8) function code(a, k, m)
    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 91.9%

    \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
  2. Step-by-step derivation
    1. *-commutative91.9%

      \[\leadsto \frac{\color{blue}{{k}^{m} \cdot a}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. add-sqr-sqrt91.9%

      \[\leadsto \frac{{k}^{m} \cdot a}{\color{blue}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
    3. times-frac91.5%

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}}} \]
    4. associate-+l+91.5%

      \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
    5. +-commutative91.5%

      \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
    6. distribute-rgt-out91.5%

      \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
    7. fma-def91.5%

      \[\leadsto \frac{{k}^{m}}{\sqrt{\color{blue}{\mathsf{fma}\left(k, 10 + k, 1\right)}}} \cdot \frac{a}{\sqrt{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
    8. associate-+l+91.5%

      \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{1 + \left(10 \cdot k + k \cdot k\right)}}} \]
    9. +-commutative91.5%

      \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{\left(10 \cdot k + k \cdot k\right) + 1}}} \]
    10. distribute-rgt-out91.5%

      \[\leadsto \frac{{k}^{m}}{\sqrt{\mathsf{fma}\left(k, 10 + k, 1\right)}} \cdot \frac{a}{\sqrt{\color{blue}{k \cdot \left(10 + k\right)} + 1}} \]
    11. fma-def91.5%

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

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

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

    \[\leadsto \color{blue}{a} \]
  6. Final simplification20.8%

    \[\leadsto a \]

Reproduce

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