Falkner and Boettcher, Appendix A

Percentage Accurate: 90.4% → 97.9%
Time: 9.3s
Alternatives: 13
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 13 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.4% 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.9% 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^{+278}:\\ \;\;\;\;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+278) 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+278) {
		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+278) 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+278) {
		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+278:
		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+278)
		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+278)
		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+278], 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^{+278}:\\
\;\;\;\;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.99999999999999993e278

    1. Initial program 98.6%

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

    if 1.99999999999999993e278 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))

    1. Initial program 66.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{\frac{1 + k \cdot \left(10 + k\right)}{{k}^{m}}}} \]
    4. 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.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+278}:\\ \;\;\;\;\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.6% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\


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

    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. associate-/l*98.3%

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

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

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

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

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

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

    if 2.5000000000000001e-9 < m

    1. Initial program 79.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{\frac{1 + k \cdot \left(10 + k\right)}{{k}^{m}}}} \]
    4. Step-by-step derivation
      1. distribute-lft-in79.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\right)} \cdot a} \]
    6. Step-by-step derivation
      1. div-inv79.7%

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

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

      \[\leadsto \left({k}^{m} \cdot \color{blue}{\frac{1}{{k}^{2}}}\right) \cdot a \]
    9. Step-by-step derivation
      1. un-div-inv60.8%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{{k}^{2}}} \cdot a \]
      2. pow-div100.0%

        \[\leadsto \color{blue}{{k}^{\left(m - 2\right)}} \cdot a \]
    10. Applied egg-rr100.0%

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

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

Alternative 3: 97.2% accurate, 1.0× speedup?

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

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

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


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

    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*97.1%

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

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

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

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

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

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

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

    if 1 < k

    1. Initial program 83.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{\frac{1 + k \cdot \left(10 + k\right)}{{k}^{m}}}} \]
    4. Step-by-step derivation
      1. distribute-lft-in83.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\right)} \cdot a} \]
    6. Step-by-step derivation
      1. div-inv83.4%

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

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

      \[\leadsto \left({k}^{m} \cdot \color{blue}{\frac{1}{{k}^{2}}}\right) \cdot a \]
    9. Step-by-step derivation
      1. un-div-inv82.0%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{{k}^{2}}} \cdot a \]
      2. pow282.0%

        \[\leadsto \frac{{k}^{m}}{\color{blue}{k \cdot k}} \cdot a \]
      3. associate-/r*95.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 1:\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{\frac{{k}^{m}}{k}}{k}\\ \end{array} \]

Alternative 4: 97.2% accurate, 1.1× speedup?

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

    1. Initial program 90.0%

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

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

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

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

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

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

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

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

    if -9.5000000000000001e-7 < m < 0.0152

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

Alternative 5: 97.2% accurate, 1.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\


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

    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*97.1%

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

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

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

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

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

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

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

    if 1 < k

    1. Initial program 83.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{\frac{1 + k \cdot \left(10 + k\right)}{{k}^{m}}}} \]
    4. Step-by-step derivation
      1. distribute-lft-in83.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\right)} \cdot a} \]
    6. Step-by-step derivation
      1. div-inv83.4%

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

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

      \[\leadsto \left({k}^{m} \cdot \color{blue}{\frac{1}{{k}^{2}}}\right) \cdot a \]
    9. Step-by-step derivation
      1. un-div-inv82.0%

        \[\leadsto \color{blue}{\frac{{k}^{m}}{{k}^{2}}} \cdot a \]
      2. pow-div94.5%

        \[\leadsto \color{blue}{{k}^{\left(m - 2\right)}} \cdot a \]
    10. Applied egg-rr94.5%

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

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

Alternative 6: 47.0% accurate, 8.7× speedup?

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

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

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


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

    1. Initial program 98.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    5. Step-by-step derivation
      1. clear-num65.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{1 + k \cdot \left(10 + k\right)}{a}}} \]
      2. inv-pow65.7%

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(k, k + 10, 1\right)}{a}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-165.7%

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

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

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

    if 9e19 < m

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a + \color{blue}{\left(-10 \cdot k\right) \cdot a} \]
      2. distribute-rgt1-in10.3%

        \[\leadsto \color{blue}{\left(-10 \cdot k + 1\right) \cdot a} \]
    9. Applied egg-rr10.3%

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

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

Alternative 7: 32.1% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -7.2 \cdot 10^{+44}:\\ \;\;\;\;0.1 \cdot \frac{a}{k}\\ \mathbf{elif}\;m \leq 2.2 \cdot 10^{+22}:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= m -7.2e+44)
   (* 0.1 (/ a k))
   (if (<= m 2.2e+22) (/ a (+ 1.0 (* k 10.0))) (* a (+ 1.0 (* k -10.0))))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -7.2e+44) {
		tmp = 0.1 * (a / k);
	} else if (m <= 2.2e+22) {
		tmp = a / (1.0 + (k * 10.0));
	} else {
		tmp = a * (1.0 + (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 <= (-7.2d+44)) then
        tmp = 0.1d0 * (a / k)
    else if (m <= 2.2d+22) then
        tmp = a / (1.0d0 + (k * 10.0d0))
    else
        tmp = a * (1.0d0 + (k * (-10.0d0)))
    end if
    code = tmp
end function
public static double code(double a, double k, double m) {
	double tmp;
	if (m <= -7.2e+44) {
		tmp = 0.1 * (a / k);
	} else if (m <= 2.2e+22) {
		tmp = a / (1.0 + (k * 10.0));
	} else {
		tmp = a * (1.0 + (k * -10.0));
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if m <= -7.2e+44:
		tmp = 0.1 * (a / k)
	elif m <= 2.2e+22:
		tmp = a / (1.0 + (k * 10.0))
	else:
		tmp = a * (1.0 + (k * -10.0))
	return tmp
function code(a, k, m)
	tmp = 0.0
	if (m <= -7.2e+44)
		tmp = Float64(0.1 * Float64(a / k));
	elseif (m <= 2.2e+22)
		tmp = Float64(a / Float64(1.0 + Float64(k * 10.0)));
	else
		tmp = Float64(a * Float64(1.0 + Float64(k * -10.0)));
	end
	return tmp
end
function tmp_2 = code(a, k, m)
	tmp = 0.0;
	if (m <= -7.2e+44)
		tmp = 0.1 * (a / k);
	elseif (m <= 2.2e+22)
		tmp = a / (1.0 + (k * 10.0));
	else
		tmp = a * (1.0 + (k * -10.0));
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, -7.2e+44], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.2e+22], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.2 \cdot 10^{+44}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{1 + \color{blue}{10 \cdot k}} \]
    6. Step-by-step derivation
      1. *-commutative13.2%

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    7. Simplified13.2%

      \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    8. Taylor expanded in k around inf 24.1%

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

    if -7.2e44 < m < 2.2e22

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

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

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

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

    if 2.2e22 < m

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a + \color{blue}{\left(-10 \cdot k\right) \cdot a} \]
      2. distribute-rgt1-in10.3%

        \[\leadsto \color{blue}{\left(-10 \cdot k + 1\right) \cdot a} \]
    9. Applied egg-rr10.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -7.2 \cdot 10^{+44}:\\ \;\;\;\;0.1 \cdot \frac{a}{k}\\ \mathbf{elif}\;m \leq 2.2 \cdot 10^{+22}:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\ \end{array} \]

Alternative 8: 47.1% accurate, 10.3× speedup?

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

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

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


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

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

    if 1.9e21 < m

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a + \color{blue}{\left(-10 \cdot k\right) \cdot a} \]
      2. distribute-rgt1-in10.3%

        \[\leadsto \color{blue}{\left(-10 \cdot k + 1\right) \cdot a} \]
    9. Applied egg-rr10.3%

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

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

Alternative 9: 27.3% accurate, 12.5× speedup?

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

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

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{1 + \color{blue}{10 \cdot k}} \]
    6. Step-by-step derivation
      1. *-commutative17.5%

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    7. Simplified17.5%

      \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    8. Taylor expanded in k around inf 17.0%

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

    if 1.29999999999999993e-295 < k < 0.10000000000000001

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 28.3% accurate, 12.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 0.0749999999999999972

    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*97.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a + -10 \cdot \left(a \cdot k\right)} \]
    6. Step-by-step derivation
      1. *-commutative34.4%

        \[\leadsto a + -10 \cdot \color{blue}{\left(k \cdot a\right)} \]
    7. Simplified34.4%

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

        \[\leadsto a + \color{blue}{\left(-10 \cdot k\right) \cdot a} \]
      2. distribute-rgt1-in34.4%

        \[\leadsto \color{blue}{\left(-10 \cdot k + 1\right) \cdot a} \]
    9. Applied egg-rr34.4%

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

    if 0.0749999999999999972 < k

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    7. Simplified25.9%

      \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    8. Taylor expanded in k around inf 24.8%

      \[\leadsto \color{blue}{0.1 \cdot \frac{a}{k}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.3%

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

Alternative 11: 28.2% accurate, 12.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 0.0749999999999999972

    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*97.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a + -10 \cdot \left(a \cdot k\right)} \]
    6. Step-by-step derivation
      1. *-commutative34.4%

        \[\leadsto a + -10 \cdot \color{blue}{\left(k \cdot a\right)} \]
    7. Simplified34.4%

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

    if 0.0749999999999999972 < k

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    7. Simplified25.9%

      \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \]
    8. Taylor expanded in k around inf 24.8%

      \[\leadsto \color{blue}{0.1 \cdot \frac{a}{k}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.3%

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

Alternative 12: 46.3% accurate, 12.6× speedup?

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

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

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


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

    1. Initial program 98.4%

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

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

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

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

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

    if 5.1000000000000002e22 < m

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a + \color{blue}{\left(-10 \cdot k\right) \cdot a} \]
      2. distribute-rgt1-in10.3%

        \[\leadsto \color{blue}{\left(-10 \cdot k + 1\right) \cdot a} \]
    9. Applied egg-rr10.3%

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

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

Alternative 13: 20.3% 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 92.6%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{a} \]
  6. Final simplification22.2%

    \[\leadsto a \]

Reproduce

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