Falkner and Boettcher, Appendix A

Percentage Accurate: 90.3% → 99.8%
Time: 14.1s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 90.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
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.8% accurate, 0.3× speedup?

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

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

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


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

    1. Initial program 94.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
    7. Simplified100.0%

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

    if 1.9999999999999999e-69 < k

    1. Initial program 93.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.8% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{{k}^{m} \cdot a}{\mathsf{hypot}\left(1, k\right)}} \]
    9. Step-by-step derivation
      1. associate-*l/98.1%

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

        \[\leadsto \frac{\color{blue}{\frac{{k}^{m} \cdot a}{\mathsf{hypot}\left(1, k\right)}}}{\mathsf{hypot}\left(1, k\right)} \]
      3. associate-/l*98.1%

        \[\leadsto \frac{\color{blue}{{k}^{m} \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}}}{\mathsf{hypot}\left(1, k\right)} \]
      4. associate-*l/98.1%

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

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

    if 1.44999999999999996 < m

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt73.8%

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

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

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

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

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

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

Alternative 3: 89.6% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{t\_0}\right)}^{2}\\


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.44999999999999996 < m

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt73.8%

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

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

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

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

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

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

Alternative 4: 97.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 97.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.94999999999999982e-15 < m

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
    7. Simplified100.0%

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

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

Alternative 5: 97.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 97.7%

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

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

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

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

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

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

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

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

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

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

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

    if 2.94999999999999982e-15 < m

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
    7. Simplified100.0%

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

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

Alternative 6: 96.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.94999999999999982e-15 < m

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
    7. Simplified100.0%

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

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

Alternative 7: 96.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 97.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.94999999999999982e-15 < m

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
    7. Simplified100.0%

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

Alternative 8: 97.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -3.5 \cdot 10^{-11} \lor \neg \left(m \leq 2.95 \cdot 10^{-15}\right):\\ \;\;\;\;{k}^{m} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (or (<= m -3.5e-11) (not (<= m 2.95e-15)))
   (* (pow k m) a)
   (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
	double tmp;
	if ((m <= -3.5e-11) || !(m <= 2.95e-15)) {
		tmp = pow(k, m) * a;
	} 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 <= (-3.5d-11)) .or. (.not. (m <= 2.95d-15))) then
        tmp = (k ** m) * a
    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 <= -3.5e-11) || !(m <= 2.95e-15)) {
		tmp = Math.pow(k, m) * a;
	} else {
		tmp = a / (1.0 + (k * (k + 10.0)));
	}
	return tmp;
}
def code(a, k, m):
	tmp = 0
	if (m <= -3.5e-11) or not (m <= 2.95e-15):
		tmp = math.pow(k, m) * a
	else:
		tmp = a / (1.0 + (k * (k + 10.0)))
	return tmp
function code(a, k, m)
	tmp = 0.0
	if ((m <= -3.5e-11) || !(m <= 2.95e-15))
		tmp = Float64((k ^ m) * a);
	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 <= -3.5e-11) || ~((m <= 2.95e-15)))
		tmp = (k ^ m) * a;
	else
		tmp = a / (1.0 + (k * (k + 10.0)));
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[Or[LessEqual[m, -3.5e-11], N[Not[LessEqual[m, 2.95e-15]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $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 -3.5 \cdot 10^{-11} \lor \neg \left(m \leq 2.95 \cdot 10^{-15}\right):\\
\;\;\;\;{k}^{m} \cdot a\\

\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 < -3.50000000000000019e-11 or 2.94999999999999982e-15 < m

    1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{{k}^{m} \cdot a} \]
    7. Simplified100.0%

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

    if -3.50000000000000019e-11 < m < 2.94999999999999982e-15

    1. Initial program 95.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 56.3% accurate, 5.4× speedup?

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

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

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

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


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

    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. *-commutative100.0%

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

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

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

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

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

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

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

    if -2.39999999999999992e36 < m < 4.7999999999999999e-47

    1. Initial program 96.0%

      \[\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}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      2. remove-double-neg95.9%

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

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

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

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

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

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

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

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

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

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

    if 4.7999999999999999e-47 < m

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 55.7% accurate, 6.0× speedup?

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

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

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

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


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

    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. *-commutative100.0%

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

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

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

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

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

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

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

    if -7.9999999999999997e35 < m < 8.2e5

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.2e5 < m

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a + k \cdot \color{blue}{\left(\left(-1 \cdot k\right) \cdot \left(a + -100 \cdot a\right)\right)} \]
      2. neg-mul-120.5%

        \[\leadsto a + k \cdot \left(\color{blue}{\left(-k\right)} \cdot \left(a + -100 \cdot a\right)\right) \]
      3. distribute-rgt1-in20.5%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \color{blue}{\left(\left(-100 + 1\right) \cdot a\right)}\right) \]
      4. metadata-eval20.5%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \left(\color{blue}{-99} \cdot a\right)\right) \]
      5. *-commutative20.5%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \color{blue}{\left(a \cdot -99\right)}\right) \]
      6. distribute-lft-neg-in20.5%

        \[\leadsto a + k \cdot \color{blue}{\left(-k \cdot \left(a \cdot -99\right)\right)} \]
      7. *-commutative20.5%

        \[\leadsto a + k \cdot \left(-\color{blue}{\left(a \cdot -99\right) \cdot k}\right) \]
      8. *-commutative20.5%

        \[\leadsto a + k \cdot \left(-\color{blue}{\left(-99 \cdot a\right)} \cdot k\right) \]
      9. associate-*r*20.5%

        \[\leadsto a + k \cdot \left(-\color{blue}{-99 \cdot \left(a \cdot k\right)}\right) \]
      10. distribute-lft-neg-in20.5%

        \[\leadsto a + k \cdot \color{blue}{\left(\left(--99\right) \cdot \left(a \cdot k\right)\right)} \]
      11. metadata-eval20.5%

        \[\leadsto a + k \cdot \left(\color{blue}{99} \cdot \left(a \cdot k\right)\right) \]
      12. associate-*r*20.5%

        \[\leadsto a + k \cdot \color{blue}{\left(\left(99 \cdot a\right) \cdot k\right)} \]
    9. Simplified20.5%

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

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

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

Alternative 11: 54.1% accurate, 8.1× speedup?

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a + k \cdot \color{blue}{\left(\left(-1 \cdot k\right) \cdot \left(a + -100 \cdot a\right)\right)} \]
      2. neg-mul-120.5%

        \[\leadsto a + k \cdot \left(\color{blue}{\left(-k\right)} \cdot \left(a + -100 \cdot a\right)\right) \]
      3. distribute-rgt1-in20.5%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \color{blue}{\left(\left(-100 + 1\right) \cdot a\right)}\right) \]
      4. metadata-eval20.5%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \left(\color{blue}{-99} \cdot a\right)\right) \]
      5. *-commutative20.5%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \color{blue}{\left(a \cdot -99\right)}\right) \]
      6. distribute-lft-neg-in20.5%

        \[\leadsto a + k \cdot \color{blue}{\left(-k \cdot \left(a \cdot -99\right)\right)} \]
      7. *-commutative20.5%

        \[\leadsto a + k \cdot \left(-\color{blue}{\left(a \cdot -99\right) \cdot k}\right) \]
      8. *-commutative20.5%

        \[\leadsto a + k \cdot \left(-\color{blue}{\left(-99 \cdot a\right)} \cdot k\right) \]
      9. associate-*r*20.5%

        \[\leadsto a + k \cdot \left(-\color{blue}{-99 \cdot \left(a \cdot k\right)}\right) \]
      10. distribute-lft-neg-in20.5%

        \[\leadsto a + k \cdot \color{blue}{\left(\left(--99\right) \cdot \left(a \cdot k\right)\right)} \]
      11. metadata-eval20.5%

        \[\leadsto a + k \cdot \left(\color{blue}{99} \cdot \left(a \cdot k\right)\right) \]
      12. associate-*r*20.5%

        \[\leadsto a + k \cdot \color{blue}{\left(\left(99 \cdot a\right) \cdot k\right)} \]
    9. Simplified20.5%

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

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

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

Alternative 12: 52.2% accurate, 8.1× speedup?

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

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

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


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

    1. Initial program 97.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.7999999999999999e-47 < m

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a + k \cdot \color{blue}{\left(\left(-1 \cdot k\right) \cdot \left(a + -100 \cdot a\right)\right)} \]
      2. neg-mul-123.3%

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

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \color{blue}{\left(\left(-100 + 1\right) \cdot a\right)}\right) \]
      4. metadata-eval23.3%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \left(\color{blue}{-99} \cdot a\right)\right) \]
      5. *-commutative23.3%

        \[\leadsto a + k \cdot \left(\left(-k\right) \cdot \color{blue}{\left(a \cdot -99\right)}\right) \]
      6. distribute-lft-neg-in23.3%

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

        \[\leadsto a + k \cdot \left(-\color{blue}{\left(a \cdot -99\right) \cdot k}\right) \]
      8. *-commutative23.3%

        \[\leadsto a + k \cdot \left(-\color{blue}{\left(-99 \cdot a\right)} \cdot k\right) \]
      9. associate-*r*23.3%

        \[\leadsto a + k \cdot \left(-\color{blue}{-99 \cdot \left(a \cdot k\right)}\right) \]
      10. distribute-lft-neg-in23.3%

        \[\leadsto a + k \cdot \color{blue}{\left(\left(--99\right) \cdot \left(a \cdot k\right)\right)} \]
      11. metadata-eval23.3%

        \[\leadsto a + k \cdot \left(\color{blue}{99} \cdot \left(a \cdot k\right)\right) \]
      12. associate-*r*23.3%

        \[\leadsto a + k \cdot \color{blue}{\left(\left(99 \cdot a\right) \cdot k\right)} \]
    9. Simplified23.3%

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

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

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

Alternative 13: 51.0% accurate, 9.5× speedup?

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.5499999999999998 < m

    1. Initial program 85.5%

      \[\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}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      2. remove-double-neg85.5%

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

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

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

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

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

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

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

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

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

      \[\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 17.4%

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

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

Alternative 14: 34.5% accurate, 9.5× speedup?

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.75 < m

    1. Initial program 85.5%

      \[\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}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      2. remove-double-neg85.5%

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

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

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

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

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

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

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

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

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

      \[\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 17.4%

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

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

Alternative 15: 25.5% accurate, 11.4× speedup?

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

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

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


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

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5 < m

    1. Initial program 85.5%

      \[\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}{a \cdot \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}} \]
      2. remove-double-neg85.5%

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

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

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

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

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

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

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

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

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

      \[\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 17.4%

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

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

Alternative 16: 20.1% 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 93.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{a} \]
  7. Add Preprocessing

Reproduce

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