Falkner and Boettcher, Appendix A

Percentage Accurate: 90.7% → 99.5%
Time: 15.3s
Alternatives: 16
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 90.7% 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.5% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;m \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{-1}{\frac{-1}{t\_0} - \frac{k}{a} \cdot \frac{k + 10}{{k}^{m}}}\\

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


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

    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. Step-by-step derivation
      1. distribute-lft-in100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{a}{\color{blue}{\mathsf{fma}\left(k, k + 10, 1\right)}}}{\frac{1}{{k}^{m}}} \]
      11. pow-flip100.0%

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

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

    if -2.0000000000000001e-4 < m < 7.49999999999999934e-5

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{\color{blue}{\frac{-1}{a \cdot {k}^{m}} - \frac{k}{a} \cdot \frac{k + 10}{{k}^{m}}}} \]
    12. Simplified99.2%

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

    if 7.49999999999999934e-5 < m

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

Alternative 2: 97.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.2 \cdot 10^{-5} \lor \neg \left(m \leq 9 \cdot 10^{-9}\right):\\
\;\;\;\;a \cdot {k}^{m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -4.19999999999999977e-5 or 8.99999999999999953e-9 < m

    1. Initial program 92.9%

      \[\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 k around 0 98.7%

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

    if -4.19999999999999977e-5 < m < 8.99999999999999953e-9

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(1 + k \cdot 10\right) + k \cdot k}}{a}} \]
      4. associate-/r/92.1%

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

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

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

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

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

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

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

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

Alternative 3: 97.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -1.7 \cdot 10^{-7}:\\ \;\;\;\;{k}^{m} \cdot \frac{a}{1 + k \cdot 10}\\ \mathbf{elif}\;m \leq 5 \cdot 10^{-5}:\\ \;\;\;\;a \cdot \frac{1}{\mathsf{fma}\left(k, k + 10, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;a \cdot {k}^{m}\\ \end{array} \end{array} \]
(FPCore (a k m)
 :precision binary64
 (if (<= m -1.7e-7)
   (* (pow k m) (/ a (+ 1.0 (* k 10.0))))
   (if (<= m 5e-5) (* a (/ 1.0 (fma k (+ k 10.0) 1.0))) (* a (pow k m)))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -1.7e-7) {
		tmp = pow(k, m) * (a / (1.0 + (k * 10.0)));
	} else if (m <= 5e-5) {
		tmp = a * (1.0 / fma(k, (k + 10.0), 1.0));
	} else {
		tmp = a * pow(k, m);
	}
	return tmp;
}
function code(a, k, m)
	tmp = 0.0
	if (m <= -1.7e-7)
		tmp = Float64((k ^ m) * Float64(a / Float64(1.0 + Float64(k * 10.0))));
	elseif (m <= 5e-5)
		tmp = Float64(a * Float64(1.0 / fma(k, Float64(k + 10.0), 1.0)));
	else
		tmp = Float64(a * (k ^ m));
	end
	return tmp
end
code[a_, k_, m_] := If[LessEqual[m, -1.7e-7], N[(N[Power[k, m], $MachinePrecision] * N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5e-5], N[(a * N[(1.0 / N[(k * N[(k + 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;m \leq 5 \cdot 10^{-5}:\\
\;\;\;\;a \cdot \frac{1}{\mathsf{fma}\left(k, k + 10, 1\right)}\\

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


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

    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 k around 0 99.0%

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

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \cdot {k}^{m} \]
    7. Simplified99.0%

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

    if -1.69999999999999987e-7 < m < 5.00000000000000024e-5

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(1 + k \cdot 10\right) + k \cdot k}}{a}} \]
      4. associate-/r/92.1%

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

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

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

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

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

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

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

    if 5.00000000000000024e-5 < m

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

Alternative 4: 97.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.49999999999999934e-5 < m

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

Alternative 5: 97.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 7.5 \cdot 10^{-5}:\\ \;\;\;\;{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 7.5e-5)
   (* (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 <= 7.5e-5) {
		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 <= 7.5d-5) 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 <= 7.5e-5) {
		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 <= 7.5e-5:
		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 <= 7.5e-5)
		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 <= 7.5e-5)
		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, 7.5e-5], 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 7.5 \cdot 10^{-5}:\\
\;\;\;\;{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 < 7.49999999999999934e-5

    1. Initial program 96.3%

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

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

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

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

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

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

    if 7.49999999999999934e-5 < m

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq 7.5 \cdot 10^{-5}:\\ \;\;\;\;{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: 97.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.49999999999999934e-5 < m

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

Alternative 7: 96.6% accurate, 1.0× speedup?

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

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


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

    1. Initial program 96.3%

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

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

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

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

    if 7.49999999999999934e-5 < m

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

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

Alternative 8: 97.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -8.6 \cdot 10^{-8} \lor \neg \left(m \leq 1.4 \cdot 10^{-8}\right):\\
\;\;\;\;a \cdot {k}^{m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -8.6000000000000002e-8 or 1.4e-8 < m

    1. Initial program 92.9%

      \[\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 k around 0 98.7%

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

    if -8.6000000000000002e-8 < m < 1.4e-8

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

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

Alternative 9: 46.8% accurate, 6.0× speedup?

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

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

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


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

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.35e16 < m

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

Alternative 10: 31.6% accurate, 6.7× speedup?

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

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

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

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


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

    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 k around 0 100.0%

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

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

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

      \[\leadsto \color{blue}{\left(0.1 \cdot \frac{a}{k}\right)} \cdot {k}^{m} \]
    9. Taylor expanded in m around 0 23.6%

      \[\leadsto \color{blue}{0.1 \cdot \frac{a}{k}} \]
    10. Step-by-step derivation
      1. clear-num24.6%

        \[\leadsto 0.1 \cdot \color{blue}{\frac{1}{\frac{k}{a}}} \]
      2. un-div-inv24.6%

        \[\leadsto \color{blue}{\frac{0.1}{\frac{k}{a}}} \]
    11. Applied egg-rr24.6%

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

    if -1.6999999999999999e103 < m < 1.06e16

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{a}{1 + \color{blue}{k \cdot 10}} \cdot {k}^{m} \]
    8. Simplified47.0%

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

    if 1.06e16 < m

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

Alternative 11: 46.8% accurate, 7.1× speedup?

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

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

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


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

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.7e16 < m

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

Alternative 12: 46.9% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq 10^{+17}:\\ \;\;\;\;\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 1e+17) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= 1e+17) {
		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 <= 1d+17) 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 <= 1e+17) {
		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 <= 1e+17:
		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 <= 1e+17)
		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 <= 1e+17)
		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, 1e+17], 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 10^{+17}:\\
\;\;\;\;\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 2 regimes
  2. if m < 1e17

    1. Initial program 95.3%

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

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

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

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

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

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

    if 1e17 < m

    1. Initial program 85.0%

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

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

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

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

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

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

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

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

Alternative 13: 28.6% accurate, 9.5× speedup?

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

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

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

    if 0.0749999999999999972 < k

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.1 \cdot \frac{a}{k}\right)} \cdot {k}^{m} \]
    9. Taylor expanded in m around 0 23.4%

      \[\leadsto \color{blue}{0.1 \cdot \frac{a}{k}} \]
    10. Step-by-step derivation
      1. clear-num24.2%

        \[\leadsto 0.1 \cdot \color{blue}{\frac{1}{\frac{k}{a}}} \]
      2. un-div-inv24.2%

        \[\leadsto \color{blue}{\frac{0.1}{\frac{k}{a}}} \]
    11. Applied egg-rr24.2%

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

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

Alternative 14: 26.6% accurate, 11.4× speedup?

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

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

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

    if 0.10000000000000001 < k

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.1 \cdot \frac{a}{k}\right)} \cdot {k}^{m} \]
    9. Taylor expanded in m around 0 23.4%

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

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

Alternative 15: 26.8% accurate, 11.4× speedup?

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

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

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

    if 0.10000000000000001 < k

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(0.1 \cdot \frac{a}{k}\right)} \cdot {k}^{m} \]
    9. Taylor expanded in m around 0 23.4%

      \[\leadsto \color{blue}{0.1 \cdot \frac{a}{k}} \]
    10. Step-by-step derivation
      1. clear-num24.2%

        \[\leadsto 0.1 \cdot \color{blue}{\frac{1}{\frac{k}{a}}} \]
      2. un-div-inv24.2%

        \[\leadsto \color{blue}{\frac{0.1}{\frac{k}{a}}} \]
    11. Applied egg-rr24.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 0.1:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;\frac{0.1}{\frac{k}{a}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 20.7% accurate, 114.0× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto a \]
  8. Add Preprocessing

Reproduce

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