Falkner and Boettcher, Appendix A

Percentage Accurate: 90.1% → 99.1%
Time: 12.5s
Alternatives: 10
Speedup: 1.0×

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 10 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: 99.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \frac{\frac{a \cdot {k}^{m}}{\mathsf{hypot}\left(1, k\right)}}{\mathsf{hypot}\left(1, k\right)} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (/ (/ (* a (pow k m)) (hypot 1.0 k)) (hypot 1.0 k)))
double code(double a, double k, double m) {
	return ((a * pow(k, m)) / hypot(1.0, k)) / hypot(1.0, k);
}
public static double code(double a, double k, double m) {
	return ((a * Math.pow(k, m)) / Math.hypot(1.0, k)) / Math.hypot(1.0, k);
}
def code(a, k, m):
	return ((a * math.pow(k, m)) / math.hypot(1.0, k)) / math.hypot(1.0, k)
function code(a, k, m)
	return Float64(Float64(Float64(a * (k ^ m)) / hypot(1.0, k)) / hypot(1.0, k))
end
function tmp = code(a, k, m)
	tmp = ((a * (k ^ m)) / hypot(1.0, k)) / hypot(1.0, k);
end
code[a_, k_, m_] := N[(N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

    \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}} \]
  4. Add Preprocessing
  5. Taylor expanded in k around 0 89.2%

    \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1} + k \cdot k} \]
  6. Step-by-step derivation
    1. add-sqr-sqrt64.3%

      \[\leadsto \color{blue}{\sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}} \cdot \sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}}} \]
    2. sqrt-div58.8%

      \[\leadsto \color{blue}{\frac{\sqrt{a \cdot {k}^{m}}}{\sqrt{1 + k \cdot k}}} \cdot \sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}} \]
    3. hypot-1-def58.8%

      \[\leadsto \frac{\sqrt{a \cdot {k}^{m}}}{\color{blue}{\mathsf{hypot}\left(1, k\right)}} \cdot \sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}} \]
    4. sqrt-div58.8%

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

      \[\leadsto \frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{\sqrt{a \cdot {k}^{m}}}{\color{blue}{\mathsf{hypot}\left(1, k\right)}} \]
  7. Applied egg-rr63.5%

    \[\leadsto \color{blue}{\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}} \]
  8. Step-by-step derivation
    1. unpow263.5%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}} \]
  9. Simplified63.5%

    \[\leadsto \color{blue}{{\left(\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}} \]
  10. Step-by-step derivation
    1. unpow263.5%

      \[\leadsto \color{blue}{\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}} \]
    2. frac-times58.8%

      \[\leadsto \color{blue}{\frac{\sqrt{a \cdot {k}^{m}} \cdot \sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right) \cdot \mathsf{hypot}\left(1, k\right)}} \]
    3. add-sqr-sqrt89.2%

      \[\leadsto \frac{\color{blue}{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right) \cdot \mathsf{hypot}\left(1, k\right)} \]
    4. hypot-udef89.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{\sqrt{1 \cdot 1 + k \cdot k}} \cdot \mathsf{hypot}\left(1, k\right)} \]
    5. hypot-udef89.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{\sqrt{1 \cdot 1 + k \cdot k} \cdot \color{blue}{\sqrt{1 \cdot 1 + k \cdot k}}} \]
    6. rem-square-sqrt89.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1 \cdot 1 + k \cdot k}} \]
    7. remove-double-div89.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{1 \cdot 1 + k \cdot \color{blue}{\frac{1}{\frac{1}{k}}}} \]
    8. reciprocal-undefine86.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{1 \cdot 1 + k \cdot \frac{1}{\color{blue}{\mathsf{reciprocal}\left(k\right)}}} \]
    9. *-un-lft-identity86.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{1 \cdot 1 + \color{blue}{1 \cdot \left(k \cdot \frac{1}{\mathsf{reciprocal}\left(k\right)}\right)}} \]
    10. div-inv86.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{1 \cdot 1 + 1 \cdot \color{blue}{\frac{k}{\mathsf{reciprocal}\left(k\right)}}} \]
    11. distribute-lft-in86.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1 \cdot \left(1 + \frac{k}{\mathsf{reciprocal}\left(k\right)}\right)}} \]
    12. *-un-lft-identity86.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1 + \frac{k}{\mathsf{reciprocal}\left(k\right)}}} \]
    13. add-sqr-sqrt86.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{\sqrt{1 + \frac{k}{\mathsf{reciprocal}\left(k\right)}} \cdot \sqrt{1 + \frac{k}{\mathsf{reciprocal}\left(k\right)}}}} \]
    14. associate-/r*86.2%

      \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{\sqrt{1 + \frac{k}{\mathsf{reciprocal}\left(k\right)}}}}{\sqrt{1 + \frac{k}{\mathsf{reciprocal}\left(k\right)}}}} \]
  11. Applied egg-rr99.4%

    \[\leadsto \color{blue}{\frac{\frac{a \cdot {k}^{m}}{\mathsf{hypot}\left(1, k\right)}}{\mathsf{hypot}\left(1, k\right)}} \]
  12. Final simplification99.4%

    \[\leadsto \frac{\frac{a \cdot {k}^{m}}{\mathsf{hypot}\left(1, k\right)}}{\mathsf{hypot}\left(1, k\right)} \]
  13. Add Preprocessing

Alternative 2: 98.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot {k}^{m}\\ \mathbf{if}\;\frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 5 \cdot 10^{+178}:\\ \;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (* a (pow k m))))
   (if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 5e+178)
     (* (/ (pow k m) (hypot 1.0 k)) (/ a (hypot 1.0 k)))
     t_0)))
double code(double a, double k, double m) {
	double t_0 = a * pow(k, m);
	double tmp;
	if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+178) {
		tmp = (pow(k, m) / hypot(1.0, k)) * (a / hypot(1.0, k));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double a, double k, double m) {
	double t_0 = a * Math.pow(k, m);
	double tmp;
	if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+178) {
		tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a / Math.hypot(1.0, k));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, k, m):
	t_0 = a * math.pow(k, m)
	tmp = 0
	if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+178:
		tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a / math.hypot(1.0, k))
	else:
		tmp = t_0
	return tmp
function code(a, k, m)
	t_0 = Float64(a * (k ^ m))
	tmp = 0.0
	if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 5e+178)
		tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a / hypot(1.0, k)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	t_0 = a * (k ^ m);
	tmp = 0.0;
	if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+178)
		tmp = ((k ^ m) / hypot(1.0, k)) * (a / hypot(1.0, k));
	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]}, If[LessEqual[N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+178], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 5 \cdot 10^{+178}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}\\

\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))) < 4.9999999999999999e178

    1. Initial program 97.1%

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

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

      \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}} \]
    4. Add Preprocessing
    5. Taylor expanded in k around 0 96.4%

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1} + k \cdot k} \]
    6. Step-by-step derivation
      1. *-commutative96.4%

        \[\leadsto \frac{\color{blue}{{k}^{m} \cdot a}}{1 + k \cdot k} \]
      2. add-sqr-sqrt96.4%

        \[\leadsto \frac{{k}^{m} \cdot a}{\color{blue}{\sqrt{1 + k \cdot k} \cdot \sqrt{1 + k \cdot k}}} \]
      3. times-frac95.9%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{\sqrt{1 + k \cdot k}} \cdot \frac{a}{\sqrt{1 + k \cdot k}}} \]
      4. hypot-1-def95.9%

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

        \[\leadsto \frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a}{\color{blue}{\mathsf{hypot}\left(1, k\right)}} \]
    7. Applied egg-rr98.8%

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

    if 4.9999999999999999e178 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))

    1. Initial program 55.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in k around 0 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 5 \cdot 10^{+178}:\\ \;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}\\ \mathbf{else}:\\ \;\;\;\;a \cdot {k}^{m}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 86.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot {k}^{m}\\ \mathbf{if}\;k \leq 0.000455:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\sqrt{t_0}}{k}\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (* a (pow k m))))
   (if (<= k 0.000455) t_0 (pow (/ (sqrt t_0) k) 2.0))))
double code(double a, double k, double m) {
	double t_0 = a * pow(k, m);
	double tmp;
	if (k <= 0.000455) {
		tmp = t_0;
	} else {
		tmp = pow((sqrt(t_0) / k), 2.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) :: tmp
    t_0 = a * (k ** m)
    if (k <= 0.000455d0) then
        tmp = t_0
    else
        tmp = (sqrt(t_0) / k) ** 2.0d0
    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 tmp;
	if (k <= 0.000455) {
		tmp = t_0;
	} else {
		tmp = Math.pow((Math.sqrt(t_0) / k), 2.0);
	}
	return tmp;
}
def code(a, k, m):
	t_0 = a * math.pow(k, m)
	tmp = 0
	if k <= 0.000455:
		tmp = t_0
	else:
		tmp = math.pow((math.sqrt(t_0) / k), 2.0)
	return tmp
function code(a, k, m)
	t_0 = Float64(a * (k ^ m))
	tmp = 0.0
	if (k <= 0.000455)
		tmp = t_0;
	else
		tmp = Float64(sqrt(t_0) / k) ^ 2.0;
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	t_0 = a * (k ^ m);
	tmp = 0.0;
	if (k <= 0.000455)
		tmp = t_0;
	else
		tmp = (sqrt(t_0) / k) ^ 2.0;
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 0.000455], t$95$0, N[Power[N[(N[Sqrt[t$95$0], $MachinePrecision] / k), $MachinePrecision], 2.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;k \leq 0.000455:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{\sqrt{t_0}}{k}\right)}^{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 4.55e-4

    1. Initial program 92.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in k around 0 99.7%

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

    if 4.55e-4 < k

    1. Initial program 84.4%

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

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

      \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}} \]
    4. Add Preprocessing
    5. Taylor expanded in k around 0 83.2%

      \[\leadsto \frac{a \cdot {k}^{m}}{\color{blue}{1} + k \cdot k} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt72.1%

        \[\leadsto \color{blue}{\sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}} \cdot \sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}}} \]
      2. sqrt-div56.4%

        \[\leadsto \color{blue}{\frac{\sqrt{a \cdot {k}^{m}}}{\sqrt{1 + k \cdot k}}} \cdot \sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}} \]
      3. hypot-1-def56.4%

        \[\leadsto \frac{\sqrt{a \cdot {k}^{m}}}{\color{blue}{\mathsf{hypot}\left(1, k\right)}} \cdot \sqrt{\frac{a \cdot {k}^{m}}{1 + k \cdot k}} \]
      4. sqrt-div56.4%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}} \]
    8. Step-by-step derivation
      1. unpow264.3%

        \[\leadsto \color{blue}{{\left(\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}} \]
    9. Simplified64.3%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}} \]
    10. Taylor expanded in k around inf 64.2%

      \[\leadsto {\color{blue}{\left(\sqrt{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}} \cdot \frac{1}{k}\right)}}^{2} \]
    11. Step-by-step derivation
      1. associate-*r/64.3%

        \[\leadsto {\color{blue}{\left(\frac{\sqrt{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}} \cdot 1}{k}\right)}}^{2} \]
      2. *-rgt-identity64.3%

        \[\leadsto {\left(\frac{\color{blue}{\sqrt{a \cdot e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}}}{k}\right)}^{2} \]
    12. Simplified64.3%

      \[\leadsto {\color{blue}{\left(\frac{\sqrt{a \cdot {k}^{m}}}{k}\right)}}^{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 0.000455:\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\sqrt{a \cdot {k}^{m}}}{k}\right)}^{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 96.5% accurate, 0.5× speedup?

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

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

\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))) < 4.9999999999999999e178

    1. Initial program 97.1%

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

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

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

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

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

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

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

    if 4.9999999999999999e178 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))

    1. Initial program 55.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in k around 0 100.0%

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

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

Alternative 5: 97.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.3:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{1 + k \cdot k}\\

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


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

    1. Initial program 96.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip3-+70.8%

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

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

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

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

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

        \[\leadsto \frac{a}{1 + \frac{k \cdot \left({k}^{3} + \color{blue}{1000}\right)}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}} \cdot {k}^{m} \]
      7. metadata-eval68.6%

        \[\leadsto \frac{a}{1 + \frac{k \cdot \left({k}^{3} + 1000\right)}{\color{blue}{100} + \left(k \cdot k - 10 \cdot k\right)}} \cdot {k}^{m} \]
      8. distribute-rgt-out--68.6%

        \[\leadsto \frac{a}{1 + \frac{k \cdot \left({k}^{3} + 1000\right)}{100 + \color{blue}{k \cdot \left(k - 10\right)}}} \cdot {k}^{m} \]
    6. Applied egg-rr68.6%

      \[\leadsto \frac{a}{1 + \color{blue}{\frac{k \cdot \left({k}^{3} + 1000\right)}{100 + k \cdot \left(k - 10\right)}}} \cdot {k}^{m} \]
    7. Step-by-step derivation
      1. associate-/l*70.8%

        \[\leadsto \frac{a}{1 + \color{blue}{\frac{k}{\frac{100 + k \cdot \left(k - 10\right)}{{k}^{3} + 1000}}}} \cdot {k}^{m} \]
      2. sub-neg70.8%

        \[\leadsto \frac{a}{1 + \frac{k}{\frac{100 + k \cdot \color{blue}{\left(k + \left(-10\right)\right)}}{{k}^{3} + 1000}}} \cdot {k}^{m} \]
      3. metadata-eval70.8%

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

      \[\leadsto \frac{a}{1 + \color{blue}{\frac{k}{\frac{100 + k \cdot \left(k + -10\right)}{{k}^{3} + 1000}}}} \cdot {k}^{m} \]
    9. Taylor expanded in k around inf 95.6%

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

        \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{\mathsf{reciprocal}\left(k\right)}}} \cdot {k}^{m} \]
    11. Simplified91.0%

      \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{\mathsf{reciprocal}\left(k\right)}}} \cdot {k}^{m} \]
    12. Step-by-step derivation
      1. div-inv91.0%

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot \frac{1}{\mathsf{reciprocal}\left(k\right)}}} \cdot {k}^{m} \]
      2. reciprocal-undefine95.6%

        \[\leadsto \frac{a}{1 + k \cdot \frac{1}{\color{blue}{\frac{1}{k}}}} \cdot {k}^{m} \]
      3. remove-double-div95.6%

        \[\leadsto \frac{a}{1 + k \cdot \color{blue}{k}} \cdot {k}^{m} \]
    13. Applied egg-rr95.6%

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

    if 3.2999999999999998 < m

    1. Initial program 76.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in k around 0 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq 3.3:\\ \;\;\;\;{k}^{m} \cdot \frac{a}{1 + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a \cdot {k}^{m}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 97.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -8.6 \cdot 10^{-18} \lor \neg \left(m \leq 1.95 \cdot 10^{-6}\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 -8.6e-18) (not (<= m 1.95e-6)))
   (* a (pow k m))
   (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
	double tmp;
	if ((m <= -8.6e-18) || !(m <= 1.95e-6)) {
		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 <= (-8.6d-18)) .or. (.not. (m <= 1.95d-6))) 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 <= -8.6e-18) || !(m <= 1.95e-6)) {
		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 <= -8.6e-18) or not (m <= 1.95e-6):
		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 <= -8.6e-18) || !(m <= 1.95e-6))
		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 <= -8.6e-18) || ~((m <= 1.95e-6)))
		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, -8.6e-18], N[Not[LessEqual[m, 1.95e-6]], $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 -8.6 \cdot 10^{-18} \lor \neg \left(m \leq 1.95 \cdot 10^{-6}\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 < -8.6000000000000005e-18 or 1.95e-6 < m

    1. Initial program 87.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in k around 0 99.4%

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

    if -8.6000000000000005e-18 < m < 1.95e-6

    1. Initial program 93.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in m around 0 93.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -8.6 \cdot 10^{-18} \lor \neg \left(m \leq 1.95 \cdot 10^{-6}\right):\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 50.0% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 750000:\\ \;\;\;\;\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 750000.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= 750000.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 <= 750000.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 <= 750000.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 <= 750000.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 <= 750000.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 <= 750000.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, 750000.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 750000:\\
\;\;\;\;\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 2 regimes
  2. if m < 7.5e5

    1. Initial program 95.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in m around 0 67.9%

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

    if 7.5e5 < m

    1. Initial program 77.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in m around 0 2.8%

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

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

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

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

Alternative 8: 33.4% accurate, 9.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 880000:\\ \;\;\;\;\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 880000.0) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= 880000.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 <= 880000.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 <= 880000.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 <= 880000.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 <= 880000.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 <= 880000.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, 880000.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 880000:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\

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


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

    1. Initial program 95.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in m around 0 67.9%

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

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

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    8. Simplified43.8%

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

    if 8.8e5 < m

    1. Initial program 77.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in m around 0 2.8%

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

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

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

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

Alternative 9: 24.5% accurate, 11.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 6.8 \cdot 10^{+40}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(a \cdot k\right)\\ \end{array} \end{array} \]
(FPCore (a k m) :precision binary64 (if (<= m 6.8e+40) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= 6.8e+40) {
		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 <= 6.8d+40) 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 <= 6.8e+40) {
		tmp = a;
	} else {
		tmp = -10.0 * (a * k);
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= 6.8e+40:
		tmp = a
	else:
		tmp = -10.0 * (a * k)
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= 6.8e+40)
		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 <= 6.8e+40)
		tmp = a;
	else
		tmp = -10.0 * (a * k);
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, 6.8e+40], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.8 \cdot 10^{+40}:\\
\;\;\;\;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.79999999999999977e40

    1. Initial program 95.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in m around 0 64.3%

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

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

    if 6.79999999999999977e40 < m

    1. Initial program 77.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
    4. Add Preprocessing
    5. Taylor expanded in m around 0 2.9%

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

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

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

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

Alternative 10: 19.7% 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 89.8%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)} \cdot {k}^{m}} \]
  4. Add Preprocessing
  5. Taylor expanded in m around 0 46.5%

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

    \[\leadsto \color{blue}{a} \]
  7. Final simplification22.1%

    \[\leadsto a \]
  8. Add Preprocessing

Reproduce

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