Falkner and Boettcher, Appendix A

Percentage Accurate: 90.9% → 99.7%
Time: 11.9s
Alternatives: 14
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 14 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.9% accurate, 1.0× speedup?

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\ t_1 := a \cdot {k}^{m}\\ t_2 := \sqrt[3]{t\_1}\\ \mathbf{if}\;k \leq 1.9 \cdot 10^{-32}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{{t\_2}^{2}}{t\_0} \cdot \frac{t\_2}{t\_0}\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (hypot k (sqrt (fma k 10.0 1.0))))
        (t_1 (* a (pow k m)))
        (t_2 (cbrt t_1)))
   (if (<= k 1.9e-32) t_1 (* (/ (pow t_2 2.0) t_0) (/ t_2 t_0)))))
double code(double a, double k, double m) {
	double t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
	double t_1 = a * pow(k, m);
	double t_2 = cbrt(t_1);
	double tmp;
	if (k <= 1.9e-32) {
		tmp = t_1;
	} else {
		tmp = (pow(t_2, 2.0) / t_0) * (t_2 / t_0);
	}
	return tmp;
}
function code(a, k, m)
	t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)))
	t_1 = Float64(a * (k ^ m))
	t_2 = cbrt(t_1)
	tmp = 0.0
	if (k <= 1.9e-32)
		tmp = t_1;
	else
		tmp = Float64(Float64((t_2 ^ 2.0) / t_0) * Float64(t_2 / t_0));
	end
	return tmp
end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1/3], $MachinePrecision]}, If[LessEqual[k, 1.9e-32], t$95$1, N[(N[(N[Power[t$95$2, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(t$95$2 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
t_1 := a \cdot {k}^{m}\\
t_2 := \sqrt[3]{t\_1}\\
\mathbf{if}\;k \leq 1.9 \cdot 10^{-32}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{{t\_2}^{2}}{t\_0} \cdot \frac{t\_2}{t\_0}\\


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

    1. Initial program 96.7%

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

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

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

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

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

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

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

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

    if 1.90000000000000004e-32 < k

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{a \cdot {k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\right)}} \]
      2. add-cube-cbrt80.0%

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

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

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

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

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

Alternative 2: 98.0% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
\mathbf{if}\;k \leq -50:\\
\;\;\;\;a \cdot {k}^{m}\\

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


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

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

    if -50 < k

    1. Initial program 90.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{k}^{m}}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)} \cdot \frac{a}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.8%

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

Alternative 3: 96.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.1 \cdot 10^{+18} \lor \neg \left(m \leq 2 \cdot 10^{-28}\right):\\
\;\;\;\;a \cdot {k}^{m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -2.1e18 or 1.99999999999999994e-28 < m

    1. Initial program 87.9%

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

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

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

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

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

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

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

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

    if -2.1e18 < m < 1.99999999999999994e-28

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 96.6%

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

    if 1.99999999999999994e-28 < m

    1. Initial program 76.2%

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

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

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

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

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

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

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

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

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

Alternative 5: 97.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 96.6%

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

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

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

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

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

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

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

    if 1.99999999999999994e-28 < m

    1. Initial program 76.2%

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

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

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

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

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

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

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

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

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

Alternative 6: 96.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.1 \cdot 10^{+18} \lor \neg \left(m \leq 2 \cdot 10^{-28}\right):\\
\;\;\;\;a \cdot {k}^{m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -2.1e18 or 1.99999999999999994e-28 < m

    1. Initial program 87.9%

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

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

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

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

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

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

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

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

    if -2.1e18 < m < 1.99999999999999994e-28

    1. Initial program 93.6%

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

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

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

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

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

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

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

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

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

Alternative 7: 29.5% accurate, 6.7× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8500000000000001e-66 < m < 4.6000000000000001e114

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \left(1 + \color{blue}{-10 \cdot k}\right) \]
      2. metadata-eval37.3%

        \[\leadsto a \cdot \left(1 + \color{blue}{\left(-10\right)} \cdot k\right) \]
      3. cancel-sign-sub-inv37.3%

        \[\leadsto a \cdot \color{blue}{\left(1 - 10 \cdot k\right)} \]
      4. *-commutative37.3%

        \[\leadsto a \cdot \left(1 - \color{blue}{k \cdot 10}\right) \]
      5. add-sqr-sqrt37.1%

        \[\leadsto a \cdot \left(1 - \color{blue}{\sqrt{k \cdot 10} \cdot \sqrt{k \cdot 10}}\right) \]
      6. sqrt-unprod37.0%

        \[\leadsto a \cdot \left(1 - \color{blue}{\sqrt{\left(k \cdot 10\right) \cdot \left(k \cdot 10\right)}}\right) \]
      7. swap-sqr37.0%

        \[\leadsto a \cdot \left(1 - \sqrt{\color{blue}{\left(k \cdot k\right) \cdot \left(10 \cdot 10\right)}}\right) \]
      8. metadata-eval37.0%

        \[\leadsto a \cdot \left(1 - \sqrt{\left(k \cdot k\right) \cdot \color{blue}{100}}\right) \]
      9. metadata-eval37.0%

        \[\leadsto a \cdot \left(1 - \sqrt{\left(k \cdot k\right) \cdot \color{blue}{\left(-10 \cdot -10\right)}}\right) \]
      10. swap-sqr37.0%

        \[\leadsto a \cdot \left(1 - \sqrt{\color{blue}{\left(k \cdot -10\right) \cdot \left(k \cdot -10\right)}}\right) \]
      11. sqrt-unprod0.1%

        \[\leadsto a \cdot \left(1 - \color{blue}{\sqrt{k \cdot -10} \cdot \sqrt{k \cdot -10}}\right) \]
      12. add-sqr-sqrt40.2%

        \[\leadsto a \cdot \left(1 - \color{blue}{k \cdot -10}\right) \]
    13. Applied egg-rr40.2%

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

    if 4.6000000000000001e114 < m

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 34.9% accurate, 6.7× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7e21 < m < 1.05000000000000005e105

    1. Initial program 88.3%

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

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

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

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

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

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

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

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

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

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

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

    if 1.05000000000000005e105 < m

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \left(1 + \color{blue}{k \cdot -10}\right) \]
    11. Simplified7.8%

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

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

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

Alternative 9: 49.8% accurate, 7.1× speedup?

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

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

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


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

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.19999999999999991e94 < m

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 29.0% accurate, 7.6× speedup?

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

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

\mathbf{elif}\;m \leq 4.1 \cdot 10^{+114}:\\
\;\;\;\;a\\

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.4999999999999998e-65 < m < 4.1000000000000001e114

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

    if 4.1000000000000001e114 < m

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -4.5 \cdot 10^{-65}:\\ \;\;\;\;0.1 \cdot \frac{a}{k}\\ \mathbf{elif}\;m \leq 4.1 \cdot 10^{+114}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;-10 \cdot \left(k \cdot a\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 49.8% accurate, 8.1× speedup?

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

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

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


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

    1. Initial program 93.9%

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

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

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

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

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

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

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

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

    if 1.19999999999999991e94 < m

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 28.6% accurate, 9.5× speedup?

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

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

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


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

    1. Initial program 96.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto a \cdot \left(1 + \color{blue}{k \cdot -10}\right) \]
    11. Simplified29.2%

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

    if 0.0749999999999999972 < k

    1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 24.0% accurate, 11.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.1 \cdot 10^{+114}:\\
\;\;\;\;a\\

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


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

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

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

    if 4.1000000000000001e114 < m

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 20.5% accurate, 114.0× speedup?

\[\begin{array}{l} \\ a \end{array} \]
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
	return a;
}
real(8) function code(a, k, m)
    real(8), intent (in) :: a
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    code = a
end function
public static double code(double a, double k, double m) {
	return a;
}
def code(a, k, m):
	return a
function code(a, k, m)
	return a
end
function tmp = code(a, k, m)
	tmp = a;
end
code[a_, k_, m_] := a
\begin{array}{l}

\\
a
\end{array}
Derivation
  1. Initial program 89.9%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{a} \]
  7. Final simplification19.2%

    \[\leadsto a \]
  8. Add Preprocessing

Reproduce

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