Falkner and Boettcher, Appendix A

Percentage Accurate: 90.1% → 97.6%
Time: 15.0s
Alternatives: 13
Speedup: 1.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 90.1% accurate, 1.0× speedup?

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

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

Alternative 1: 97.6% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 98.6%

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

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

    1. Initial program 67.9%

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

      \[\leadsto \color{blue}{e^{\log k \cdot m} \cdot a} \]
    3. Step-by-step derivation
      1. exp-to-pow100.0%

        \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
      2. *-commutative100.0%

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

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

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

Alternative 2: 97.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 94.3%

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

      \[\leadsto \color{blue}{e^{\log k \cdot m} \cdot a} \]
    3. Step-by-step derivation
      1. exp-to-pow99.4%

        \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
      2. *-commutative99.4%

        \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    4. Simplified99.4%

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

    if 0.225000000000000006 < k

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a \cdot e^{-1 \cdot \left(\log \left(\frac{1}{k}\right) \cdot m\right)}}{\color{blue}{k \cdot k}} \]
      2. times-frac93.0%

        \[\leadsto \color{blue}{\frac{a}{k} \cdot \frac{e^{-1 \cdot \left(\log \left(\frac{1}{k}\right) \cdot m\right)}}{k}} \]
      3. mul-1-neg93.0%

        \[\leadsto \frac{a}{k} \cdot \frac{e^{\color{blue}{-\log \left(\frac{1}{k}\right) \cdot m}}}{k} \]
      4. *-commutative93.0%

        \[\leadsto \frac{a}{k} \cdot \frac{e^{-\color{blue}{m \cdot \log \left(\frac{1}{k}\right)}}}{k} \]
      5. distribute-rgt-neg-in93.0%

        \[\leadsto \frac{a}{k} \cdot \frac{e^{\color{blue}{m \cdot \left(-\log \left(\frac{1}{k}\right)\right)}}}{k} \]
      6. log-rec93.0%

        \[\leadsto \frac{a}{k} \cdot \frac{e^{m \cdot \left(-\color{blue}{\left(-\log k\right)}\right)}}{k} \]
    6. Simplified93.0%

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

        \[\leadsto \color{blue}{\frac{\frac{a}{k} \cdot e^{m \cdot \left(-\left(-\log k\right)\right)}}{k}} \]
      2. remove-double-neg93.0%

        \[\leadsto \frac{\frac{a}{k} \cdot e^{m \cdot \color{blue}{\log k}}}{k} \]
      3. *-commutative93.0%

        \[\leadsto \frac{\frac{a}{k} \cdot e^{\color{blue}{\log k \cdot m}}}{k} \]
      4. pow-to-exp93.0%

        \[\leadsto \frac{\frac{a}{k} \cdot \color{blue}{{k}^{m}}}{k} \]
    8. Applied egg-rr93.0%

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

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

Alternative 3: 97.0% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 89.6%

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

      \[\leadsto \color{blue}{e^{\log k \cdot m} \cdot a} \]
    3. Step-by-step derivation
      1. exp-to-pow100.0%

        \[\leadsto \color{blue}{{k}^{m}} \cdot a \]
      2. *-commutative100.0%

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

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

    if -5.20000000000000006e-17 < m < 9.4999999999999999e-14

    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. div-inv96.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 62.5% accurate, 6.7× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

    if -0.93999999999999995 < m < 1.94999999999999996

    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. div-inv96.7%

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

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

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

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

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

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

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

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

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

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

    if 1.94999999999999996 < m

    1. Initial program 79.5%

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + 10 \cdot k}} \]
    4. Taylor expanded in k around 0 23.2%

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

        \[\leadsto a + \left(\color{blue}{\left(-10 \cdot k\right) \cdot a} + 100 \cdot \left({k}^{2} \cdot a\right)\right) \]
      2. associate-*r*23.2%

        \[\leadsto a + \left(\left(-10 \cdot k\right) \cdot a + \color{blue}{\left(100 \cdot {k}^{2}\right) \cdot a}\right) \]
      3. distribute-rgt-out30.0%

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

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

        \[\leadsto a + a \cdot \left(k \cdot -10 + \color{blue}{{k}^{2} \cdot 100}\right) \]
      6. unpow230.0%

        \[\leadsto a + a \cdot \left(k \cdot -10 + \color{blue}{\left(k \cdot k\right)} \cdot 100\right) \]
      7. associate-*l*30.0%

        \[\leadsto a + a \cdot \left(k \cdot -10 + \color{blue}{k \cdot \left(k \cdot 100\right)}\right) \]
    6. Simplified30.0%

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

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

Alternative 5: 56.4% accurate, 7.5× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot 10 + 10 \cdot \frac{1}{k}}\\


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

    1. Initial program 100.0%

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

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

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

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

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

    if -0.93999999999999995 < m < 1.3199999999999999e50

    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. div-inv93.7%

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

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

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

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

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

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

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

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

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

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

    if 1.3199999999999999e50 < m

    1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{a}{\color{blue}{10 \cdot \frac{1}{k} + 10 \cdot k}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification55.3%

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

Alternative 6: 54.8% accurate, 8.7× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

    if -0.93999999999999995 < m < 5.5e15

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

    if 5.5e15 < m

    1. Initial program 79.3%

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

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

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

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

Alternative 7: 46.9% accurate, 10.2× speedup?

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

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

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


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

    1. Initial program 88.1%

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

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

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

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

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

    if 6.4999999999999995e-294 < k < 0.23000000000000001

    1. Initial program 99.9%

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

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

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

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

Alternative 8: 47.2% accurate, 10.2× speedup?

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

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

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

    if 1.2500000000000001e-294 < k < 0.0749999999999999972

    1. Initial program 99.9%

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

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

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

    if 0.0749999999999999972 < k

    1. Initial program 86.6%

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

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

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

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

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

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

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

Alternative 9: 47.2% accurate, 10.2× speedup?

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

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

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

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


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

    1. Initial program 89.6%

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

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

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

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

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

    if 5.00000000000000008e-295 < k < 1

    1. Initial program 99.9%

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

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

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

    if 1 < k

    1. Initial program 86.4%

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

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

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

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

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

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

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

Alternative 10: 54.1% accurate, 10.2× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

    if -0.93999999999999995 < m < 6.4e15

    1. Initial program 96.8%

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

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

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

    if 6.4e15 < m

    1. Initial program 79.3%

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

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

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

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

Alternative 11: 46.8% accurate, 12.5× speedup?

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

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

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


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

    1. Initial program 88.1%

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

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

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

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

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

    if 4.00000000000000024e-295 < k < 1

    1. Initial program 99.9%

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

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

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

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

Alternative 12: 26.4% accurate, 16.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a\\

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


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

    1. Initial program 94.3%

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

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

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

    if 0.10000000000000001 < k

    1. Initial program 86.6%

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

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

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

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

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

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

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

Alternative 13: 20.2% accurate, 114.0× speedup?

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

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

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

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

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

    \[\leadsto a \]

Reproduce

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