Falkner and Boettcher, Appendix A

Percentage Accurate: 90.3% → 97.7%
Time: 12.4s
Alternatives: 14
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 90.3% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot {k}^{m}\\ \mathbf{if}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+270}:\\ \;\;\;\;a \cdot \frac{{k}^{m}}{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 (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 2e+270)
     (* a (/ (pow k m) (+ 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 ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+270) {
		tmp = a * (pow(k, m) / (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 ((t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))) <= 2d+270) then
        tmp = a * ((k ** m) / (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 ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+270) {
		tmp = a * (Math.pow(k, m) / (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 (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+270:
		tmp = a * (math.pow(k, m) / (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 (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 2e+270)
		tmp = Float64(a * Float64((k ^ m) / 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 ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+270)
		tmp = a * ((k ^ m) / (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[N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+270], N[(a * N[(N[Power[k, m], $MachinePrecision] / 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}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+270}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 2.0000000000000001e270

    1. Initial program 98.0%

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

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

        \[\leadsto \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({k}^{m}\right), \left(\left(1 + 10 \cdot k\right) + k \cdot k\right)\right), a\right) \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \left(\left(1 + 10 \cdot k\right) + k \cdot k\right)\right), a\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \left(1 + \left(10 \cdot k + k \cdot k\right)\right)\right), a\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \left(10 \cdot k + k \cdot k\right)\right)\right), a\right) \]
      8. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \left(k \cdot \left(10 + k\right)\right)\right)\right), a\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right), a\right) \]
      10. +-lowering-+.f6498.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \mathsf{+.f64}\left(10, k\right)\right)\right)\right), a\right) \]
    4. Applied egg-rr98.0%

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

    if 2.0000000000000001e270 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k)))

    1. Initial program 60.3%

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{\left({k}^{m}\right)}\right) \]
      2. pow-lowering-pow.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(a, \mathsf{pow.f64}\left(k, \color{blue}{m}\right)\right) \]
    5. Simplified100.0%

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

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

Alternative 2: 97.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.00039:\\ \;\;\;\;a \cdot \frac{{k}^{m}}{k \cdot k}\\ \mathbf{elif}\;m \leq 2.2 \cdot 10^{-15}:\\ \;\;\;\;\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 -0.00039)
   (* a (/ (pow k m) (* k k)))
   (if (<= m 2.2e-15) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (pow k m)))))
double code(double a, double k, double m) {
	double tmp;
	if (m <= -0.00039) {
		tmp = a * (pow(k, m) / (k * k));
	} else if (m <= 2.2e-15) {
		tmp = 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 <= (-0.00039d0)) then
        tmp = a * ((k ** m) / (k * k))
    else if (m <= 2.2d-15) then
        tmp = 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 <= -0.00039) {
		tmp = a * (Math.pow(k, m) / (k * k));
	} else if (m <= 2.2e-15) {
		tmp = 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 <= -0.00039:
		tmp = a * (math.pow(k, m) / (k * k))
	elif m <= 2.2e-15:
		tmp = 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 <= -0.00039)
		tmp = Float64(a * Float64((k ^ m) / Float64(k * k)));
	elseif (m <= 2.2e-15)
		tmp = 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 <= -0.00039)
		tmp = a * ((k ^ m) / (k * k));
	elseif (m <= 2.2e-15)
		tmp = a / (1.0 + (k * (k + 10.0)));
	else
		tmp = a * (k ^ m);
	end
	tmp_2 = tmp;
end
code[a_, k_, m_] := If[LessEqual[m, -0.00039], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.2e-15], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto \frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{{k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({k}^{m}\right), \left(\left(1 + 10 \cdot k\right) + k \cdot k\right)\right), a\right) \]
      5. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \left(\left(1 + 10 \cdot k\right) + k \cdot k\right)\right), a\right) \]
      6. associate-+l+N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \left(1 + \left(10 \cdot k + k \cdot k\right)\right)\right), a\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \left(10 \cdot k + k \cdot k\right)\right)\right), a\right) \]
      8. distribute-rgt-outN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \left(k \cdot \left(10 + k\right)\right)\right)\right), a\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right), a\right) \]
      10. +-lowering-+.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \mathsf{+.f64}\left(10, k\right)\right)\right)\right), a\right) \]
    4. Applied egg-rr100.0%

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

      \[\leadsto \mathsf{*.f64}\left(\color{blue}{\left(\frac{e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}}{{k}^{2}}\right)}, a\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(e^{-1 \cdot \left(m \cdot \log \left(\frac{1}{k}\right)\right)}\right), \left({k}^{2}\right)\right), a\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(e^{-1 \cdot \left(\log \left(\frac{1}{k}\right) \cdot m\right)}\right), \left({k}^{2}\right)\right), a\right) \]
      3. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(e^{\left(-1 \cdot \log \left(\frac{1}{k}\right)\right) \cdot m}\right), \left({k}^{2}\right)\right), a\right) \]
      4. exp-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({\left(e^{-1 \cdot \log \left(\frac{1}{k}\right)}\right)}^{m}\right), \left({k}^{2}\right)\right), a\right) \]
      5. neg-mul-1N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({\left(e^{\mathsf{neg}\left(\log \left(\frac{1}{k}\right)\right)}\right)}^{m}\right), \left({k}^{2}\right)\right), a\right) \]
      6. log-recN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({\left(e^{\mathsf{neg}\left(\left(\mathsf{neg}\left(\log k\right)\right)\right)}\right)}^{m}\right), \left({k}^{2}\right)\right), a\right) \]
      7. remove-double-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({\left(e^{\log k}\right)}^{m}\right), \left({k}^{2}\right)\right), a\right) \]
      8. exp-prodN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(e^{\log k \cdot m}\right), \left({k}^{2}\right)\right), a\right) \]
      9. exp-to-powN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left({k}^{m}\right), \left({k}^{2}\right)\right), a\right) \]
      10. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \left({k}^{2}\right)\right), a\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \left(k \cdot k\right)\right), a\right) \]
      12. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, m\right), \mathsf{*.f64}\left(k, k\right)\right), a\right) \]
    7. Simplified100.0%

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

    if -3.89999999999999993e-4 < m < 2.19999999999999986e-15

    1. Initial program 94.5%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified92.5%

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

    if 2.19999999999999986e-15 < m

    1. Initial program 75.3%

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{\left({k}^{m}\right)}\right) \]
      2. pow-lowering-pow.f6499.0%

        \[\leadsto \mathsf{*.f64}\left(a, \mathsf{pow.f64}\left(k, \color{blue}{m}\right)\right) \]
    5. Simplified99.0%

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

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

Alternative 3: 96.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot {k}^{m}\\ \mathbf{if}\;m \leq -3.2 \cdot 10^{-10}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 2.2 \cdot 10^{-15}:\\ \;\;\;\;\frac{a}{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 -3.2e-10)
     t_0
     (if (<= m 2.2e-15) (/ a (+ 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 <= -3.2e-10) {
		tmp = t_0;
	} else if (m <= 2.2e-15) {
		tmp = a / (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 <= (-3.2d-10)) then
        tmp = t_0
    else if (m <= 2.2d-15) then
        tmp = a / (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 <= -3.2e-10) {
		tmp = t_0;
	} else if (m <= 2.2e-15) {
		tmp = a / (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 <= -3.2e-10:
		tmp = t_0
	elif m <= 2.2e-15:
		tmp = a / (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 <= -3.2e-10)
		tmp = t_0;
	elseif (m <= 2.2e-15)
		tmp = Float64(a / 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 <= -3.2e-10)
		tmp = t_0;
	elseif (m <= 2.2e-15)
		tmp = a / (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, -3.2e-10], t$95$0, If[LessEqual[m, 2.2e-15], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -3.2 \cdot 10^{-10}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;m \leq 2.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{a}{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 < -3.19999999999999981e-10 or 2.19999999999999986e-15 < m

    1. Initial program 87.8%

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

      \[\leadsto \color{blue}{a \cdot {k}^{m}} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(a, \color{blue}{\left({k}^{m}\right)}\right) \]
      2. pow-lowering-pow.f6498.5%

        \[\leadsto \mathsf{*.f64}\left(a, \mathsf{pow.f64}\left(k, \color{blue}{m}\right)\right) \]
    5. Simplified98.5%

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

    if -3.19999999999999981e-10 < m < 2.19999999999999986e-15

    1. Initial program 94.3%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified93.7%

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

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

Alternative 4: 65.6% accurate, 4.2× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 - \frac{\left(1000 + \frac{10000}{k}\right) + \frac{100000}{k \cdot k}}{k}}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified34.1%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f6434.1%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr34.1%

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

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

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

    if -1.12e8 < m < 8e18

    1. Initial program 93.8%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified85.9%

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

    if 8e18 < m

    1. Initial program 75.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f642.9%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr2.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{1}{10} + \frac{-1}{100} \cdot k\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \color{blue}{\left(\frac{-1}{100} \cdot k\right)}\right)\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \left(k \cdot \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f642.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \mathsf{*.f64}\left(k, \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
    10. Simplified2.3%

      \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{0.1 + k \cdot -0.01}}} \]
    11. Taylor expanded in k around -inf

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(-1 \cdot \frac{1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)}{k} - 99\right)}\right) \]
    12. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(-1 \cdot \frac{1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)}{k} + \color{blue}{\left(\mathsf{neg}\left(99\right)\right)}\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \color{blue}{-1 \cdot \frac{1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)}{k}}\right)\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \left(\mathsf{neg}\left(\frac{1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)}{k}\right)\right)\right)\right) \]
      4. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) - \color{blue}{\frac{1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)}{k}}\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\left(\mathsf{neg}\left(99\right)\right), \color{blue}{\left(\frac{1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)}{k}\right)}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \left(\frac{\color{blue}{1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)}}{k}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\left(1000 + \left(10000 \cdot \frac{1}{k} + \frac{100000}{{k}^{2}}\right)\right), \color{blue}{k}\right)\right)\right) \]
      8. associate-+r+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\left(\left(1000 + 10000 \cdot \frac{1}{k}\right) + \frac{100000}{{k}^{2}}\right), k\right)\right)\right) \]
      9. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(1000 + 10000 \cdot \frac{1}{k}\right), \left(\frac{100000}{{k}^{2}}\right)\right), k\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(1000, \left(10000 \cdot \frac{1}{k}\right)\right), \left(\frac{100000}{{k}^{2}}\right)\right), k\right)\right)\right) \]
      11. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(1000, \left(\frac{10000 \cdot 1}{k}\right)\right), \left(\frac{100000}{{k}^{2}}\right)\right), k\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(1000, \left(\frac{10000}{k}\right)\right), \left(\frac{100000}{{k}^{2}}\right)\right), k\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(1000, \mathsf{/.f64}\left(10000, k\right)\right), \left(\frac{100000}{{k}^{2}}\right)\right), k\right)\right)\right) \]
      14. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(1000, \mathsf{/.f64}\left(10000, k\right)\right), \mathsf{/.f64}\left(100000, \left({k}^{2}\right)\right)\right), k\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(1000, \mathsf{/.f64}\left(10000, k\right)\right), \mathsf{/.f64}\left(100000, \left(k \cdot k\right)\right)\right), k\right)\right)\right) \]
      16. *-lowering-*.f6436.5%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{+.f64}\left(1000, \mathsf{/.f64}\left(10000, k\right)\right), \mathsf{/.f64}\left(100000, \mathsf{*.f64}\left(k, k\right)\right)\right), k\right)\right)\right) \]
    13. Simplified36.5%

      \[\leadsto \frac{a}{\color{blue}{-99 - \frac{\left(1000 + \frac{10000}{k}\right) + \frac{100000}{k \cdot k}}{k}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification61.9%

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

Alternative 5: 63.6% accurate, 5.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 - \frac{1000 + \frac{10000}{k}}{k}}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified34.1%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f6434.1%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr34.1%

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

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

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

    if -1.12e8 < m < 8e18

    1. Initial program 93.8%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified85.9%

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

    if 8e18 < m

    1. Initial program 75.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f642.9%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr2.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{1}{10} + \frac{-1}{100} \cdot k\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \color{blue}{\left(\frac{-1}{100} \cdot k\right)}\right)\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \left(k \cdot \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f642.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \mathsf{*.f64}\left(k, \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
    10. Simplified2.3%

      \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{0.1 + k \cdot -0.01}}} \]
    11. Taylor expanded in k around inf

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(-1 \cdot \frac{1000 + 10000 \cdot \frac{1}{k}}{k} - 99\right)}\right) \]
    12. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(-1 \cdot \frac{1000 + 10000 \cdot \frac{1}{k}}{k} + \color{blue}{\left(\mathsf{neg}\left(99\right)\right)}\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \color{blue}{-1 \cdot \frac{1000 + 10000 \cdot \frac{1}{k}}{k}}\right)\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \left(\mathsf{neg}\left(\frac{1000 + 10000 \cdot \frac{1}{k}}{k}\right)\right)\right)\right) \]
      4. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) - \color{blue}{\frac{1000 + 10000 \cdot \frac{1}{k}}{k}}\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\left(\mathsf{neg}\left(99\right)\right), \color{blue}{\left(\frac{1000 + 10000 \cdot \frac{1}{k}}{k}\right)}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \left(\frac{\color{blue}{1000 + 10000 \cdot \frac{1}{k}}}{k}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\left(1000 + 10000 \cdot \frac{1}{k}\right), \color{blue}{k}\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \left(10000 \cdot \frac{1}{k}\right)\right), k\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \left(\frac{10000 \cdot 1}{k}\right)\right), k\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \left(\frac{10000}{k}\right)\right), k\right)\right)\right) \]
      11. /-lowering-/.f6429.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \mathsf{/.f64}\left(10000, k\right)\right), k\right)\right)\right) \]
    13. Simplified29.3%

      \[\leadsto \frac{a}{\color{blue}{-99 - \frac{1000 + \frac{10000}{k}}{k}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification59.4%

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

Alternative 6: 62.0% accurate, 5.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 - \frac{1000 + \frac{10000}{k}}{k}}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified34.1%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6459.1%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified59.1%

      \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    9. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{k \cdot k}{a}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(k \cdot k\right)\right), a\right) \]
      5. *-lowering-*.f6461.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(k, k\right)\right), a\right) \]
    10. Applied egg-rr61.2%

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

    if -1.12e8 < m < 8e18

    1. Initial program 93.8%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified85.9%

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

    if 8e18 < m

    1. Initial program 75.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f642.9%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr2.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{1}{10} + \frac{-1}{100} \cdot k\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \color{blue}{\left(\frac{-1}{100} \cdot k\right)}\right)\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \left(k \cdot \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f642.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \mathsf{*.f64}\left(k, \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
    10. Simplified2.3%

      \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{0.1 + k \cdot -0.01}}} \]
    11. Taylor expanded in k around inf

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(-1 \cdot \frac{1000 + 10000 \cdot \frac{1}{k}}{k} - 99\right)}\right) \]
    12. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(-1 \cdot \frac{1000 + 10000 \cdot \frac{1}{k}}{k} + \color{blue}{\left(\mathsf{neg}\left(99\right)\right)}\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \color{blue}{-1 \cdot \frac{1000 + 10000 \cdot \frac{1}{k}}{k}}\right)\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \left(\mathsf{neg}\left(\frac{1000 + 10000 \cdot \frac{1}{k}}{k}\right)\right)\right)\right) \]
      4. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) - \color{blue}{\frac{1000 + 10000 \cdot \frac{1}{k}}{k}}\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(\left(\mathsf{neg}\left(99\right)\right), \color{blue}{\left(\frac{1000 + 10000 \cdot \frac{1}{k}}{k}\right)}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \left(\frac{\color{blue}{1000 + 10000 \cdot \frac{1}{k}}}{k}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\left(1000 + 10000 \cdot \frac{1}{k}\right), \color{blue}{k}\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \left(10000 \cdot \frac{1}{k}\right)\right), k\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \left(\frac{10000 \cdot 1}{k}\right)\right), k\right)\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \left(\frac{10000}{k}\right)\right), k\right)\right)\right) \]
      11. /-lowering-/.f6429.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{\_.f64}\left(-99, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1000, \mathsf{/.f64}\left(10000, k\right)\right), k\right)\right)\right) \]
    13. Simplified29.3%

      \[\leadsto \frac{a}{\color{blue}{-99 - \frac{1000 + \frac{10000}{k}}{k}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification57.9%

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

Alternative 7: 56.0% accurate, 6.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified34.1%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6459.1%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified59.1%

      \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    9. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{k \cdot k}{a}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(k \cdot k\right)\right), a\right) \]
      5. *-lowering-*.f6461.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(k, k\right)\right), a\right) \]
    10. Applied egg-rr61.2%

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

    if -1.12e8 < m < 1.2e20

    1. Initial program 93.8%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified85.9%

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

    if 1.2e20 < m

    1. Initial program 75.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f642.9%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr2.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{1}{10} + \frac{-1}{100} \cdot k\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \color{blue}{\left(\frac{-1}{100} \cdot k\right)}\right)\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \left(k \cdot \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f642.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \mathsf{*.f64}\left(k, \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
    10. Simplified2.3%

      \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{0.1 + k \cdot -0.01}}} \]
    11. Taylor expanded in k around inf

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(-1 \cdot \left(99 + 1000 \cdot \frac{1}{k}\right)\right)}\right) \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\mathsf{neg}\left(\left(99 + 1000 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      2. distribute-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \color{blue}{\left(\mathsf{neg}\left(1000 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(\left(\mathsf{neg}\left(99\right)\right), \color{blue}{\left(\mathsf{neg}\left(1000 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\color{blue}{1000 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\frac{1000 \cdot 1}{k}\right)\right)\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\frac{1000}{k}\right)\right)\right)\right) \]
      7. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\frac{\mathsf{neg}\left(1000\right)}{\color{blue}{k}}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(1000\right)\right), \color{blue}{k}\right)\right)\right) \]
      9. metadata-eval13.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \mathsf{/.f64}\left(-1000, k\right)\right)\right) \]
    13. Simplified13.3%

      \[\leadsto \frac{a}{\color{blue}{-99 + \frac{-1000}{k}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.4%

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

Alternative 8: 55.3% accurate, 6.7× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified34.1%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6459.1%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified59.1%

      \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    9. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{k \cdot k}{a}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(k \cdot k\right)\right), a\right) \]
      5. *-lowering-*.f6461.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(k, k\right)\right), a\right) \]
    10. Applied egg-rr61.2%

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

    if -1.12e8 < m < 1.55e19

    1. Initial program 93.8%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified85.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2}\right)}\right)\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{k}\right)\right)\right) \]
      2. *-lowering-*.f6484.5%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right)\right) \]
    8. Simplified84.5%

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

    if 1.55e19 < m

    1. Initial program 75.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f642.9%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr2.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{1}{10} + \frac{-1}{100} \cdot k\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \color{blue}{\left(\frac{-1}{100} \cdot k\right)}\right)\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \left(k \cdot \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f642.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \mathsf{*.f64}\left(k, \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
    10. Simplified2.3%

      \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{0.1 + k \cdot -0.01}}} \]
    11. Taylor expanded in k around inf

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(-1 \cdot \left(99 + 1000 \cdot \frac{1}{k}\right)\right)}\right) \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\mathsf{neg}\left(\left(99 + 1000 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      2. distribute-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \color{blue}{\left(\mathsf{neg}\left(1000 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(\left(\mathsf{neg}\left(99\right)\right), \color{blue}{\left(\mathsf{neg}\left(1000 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\color{blue}{1000 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\frac{1000 \cdot 1}{k}\right)\right)\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\frac{1000}{k}\right)\right)\right)\right) \]
      7. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\frac{\mathsf{neg}\left(1000\right)}{\color{blue}{k}}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(1000\right)\right), \color{blue}{k}\right)\right)\right) \]
      9. metadata-eval13.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \mathsf{/.f64}\left(-1000, k\right)\right)\right) \]
    13. Simplified13.3%

      \[\leadsto \frac{a}{\color{blue}{-99 + \frac{-1000}{k}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification51.9%

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

Alternative 9: 45.8% accurate, 6.7× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified36.1%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6458.1%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified58.1%

      \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    9. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{k \cdot k}{a}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(k \cdot k\right)\right), a\right) \]
      5. *-lowering-*.f6460.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(k, k\right)\right), a\right) \]
    10. Applied egg-rr60.1%

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

    if -4.20000000000000016e-22 < m < 8e18

    1. Initial program 93.2%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified89.0%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + 10 \cdot k\right)}\right) \]
    7. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left(10 \cdot k\right)}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{10}\right)\right)\right) \]
      3. *-lowering-*.f6456.2%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{10}\right)\right)\right) \]
    8. Simplified56.2%

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

    if 8e18 < m

    1. Initial program 75.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified2.9%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f642.9%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr2.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{1}{10} + \frac{-1}{100} \cdot k\right)}\right)\right)\right) \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \color{blue}{\left(\frac{-1}{100} \cdot k\right)}\right)\right)\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \left(k \cdot \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f642.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{+.f64}\left(\frac{1}{10}, \mathsf{*.f64}\left(k, \color{blue}{\frac{-1}{100}}\right)\right)\right)\right)\right) \]
    10. Simplified2.3%

      \[\leadsto \frac{a}{1 + \frac{k}{\color{blue}{0.1 + k \cdot -0.01}}} \]
    11. Taylor expanded in k around inf

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(-1 \cdot \left(99 + 1000 \cdot \frac{1}{k}\right)\right)}\right) \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\mathsf{neg}\left(\left(99 + 1000 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      2. distribute-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(\mathsf{neg}\left(99\right)\right) + \color{blue}{\left(\mathsf{neg}\left(1000 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(\left(\mathsf{neg}\left(99\right)\right), \color{blue}{\left(\mathsf{neg}\left(1000 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\color{blue}{1000 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      5. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\frac{1000 \cdot 1}{k}\right)\right)\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\mathsf{neg}\left(\frac{1000}{k}\right)\right)\right)\right) \]
      7. distribute-neg-fracN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \left(\frac{\mathsf{neg}\left(1000\right)}{\color{blue}{k}}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(1000\right)\right), \color{blue}{k}\right)\right)\right) \]
      9. metadata-eval13.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(-99, \mathsf{/.f64}\left(-1000, k\right)\right)\right) \]
    13. Simplified13.3%

      \[\leadsto \frac{a}{\color{blue}{-99 + \frac{-1000}{k}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification42.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -4.2 \cdot 10^{-22}:\\ \;\;\;\;a \cdot \frac{1}{k \cdot k}\\ \mathbf{elif}\;m \leq 8 \cdot 10^{+18}:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 46.8% accurate, 6.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq -4.7 \cdot 10^{-303}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\

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

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


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

    1. Initial program 85.7%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified20.6%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6428.2%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified28.2%

      \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    9. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{k \cdot k}{a}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(k \cdot k\right)\right), a\right) \]
      5. *-lowering-*.f6429.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(k, k\right)\right), a\right) \]
    10. Applied egg-rr29.3%

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

    if -4.6999999999999997e-303 < k < 0.0749999999999999972

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified42.3%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f6442.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr42.3%

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

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

        \[\leadsto a + -10 \cdot \left(k \cdot \color{blue}{a}\right) \]
      2. associate-*r*N/A

        \[\leadsto a + \left(-10 \cdot k\right) \cdot \color{blue}{a} \]
      3. distribute-rgt1-inN/A

        \[\leadsto \left(-10 \cdot k + 1\right) \cdot \color{blue}{a} \]
      4. +-commutativeN/A

        \[\leadsto \left(1 + -10 \cdot k\right) \cdot a \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(1 + -10 \cdot k\right), \color{blue}{a}\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(-10 \cdot k\right)\right), a\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(k \cdot -10\right)\right), a\right) \]
      8. *-lowering-*.f6442.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, -10\right)\right), a\right) \]
    10. Simplified42.3%

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

    if 0.0749999999999999972 < k

    1. Initial program 83.1%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified54.5%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right) \]
      4. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right) \]
      6. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \left(10 \cdot 1 + 1 \cdot k\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \left(10 + \color{blue}{1} \cdot k\right)\right)\right) \]
      8. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \left(10 + k\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{\left(10 + k\right)}\right)\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \left(k + \color{blue}{10}\right)\right)\right) \]
      11. +-lowering-+.f6454.5%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right) \]
    8. Simplified54.5%

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

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

Alternative 11: 46.6% accurate, 6.7× speedup?

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

\\
\begin{array}{l}
t_0 := a \cdot \frac{1}{k \cdot k}\\
\mathbf{if}\;k \leq -4.7 \cdot 10^{-303}:\\
\;\;\;\;t\_0\\

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

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


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

    1. Initial program 84.4%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified37.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6441.0%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified41.0%

      \[\leadsto \frac{a}{\color{blue}{k \cdot k}} \]
    9. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{k \cdot k}{a}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{k \cdot k} \cdot \color{blue}{a} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{k \cdot k}\right), \color{blue}{a}\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(k \cdot k\right)\right), a\right) \]
      5. *-lowering-*.f6441.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{*.f64}\left(k, k\right)\right), a\right) \]
    10. Applied egg-rr41.6%

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

    if -4.6999999999999997e-303 < k < 0.10000000000000001

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified42.3%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f6442.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr42.3%

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

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

        \[\leadsto a + -10 \cdot \left(k \cdot \color{blue}{a}\right) \]
      2. associate-*r*N/A

        \[\leadsto a + \left(-10 \cdot k\right) \cdot \color{blue}{a} \]
      3. distribute-rgt1-inN/A

        \[\leadsto \left(-10 \cdot k + 1\right) \cdot \color{blue}{a} \]
      4. +-commutativeN/A

        \[\leadsto \left(1 + -10 \cdot k\right) \cdot a \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(1 + -10 \cdot k\right), \color{blue}{a}\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(-10 \cdot k\right)\right), a\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(k \cdot -10\right)\right), a\right) \]
      8. *-lowering-*.f6442.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, -10\right)\right), a\right) \]
    10. Simplified42.3%

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

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

Alternative 12: 46.6% accurate, 6.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq -4.7 \cdot 10^{-303}:\\
\;\;\;\;t\_0\\

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

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


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

    1. Initial program 84.4%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified37.9%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6441.0%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified41.0%

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

    if -4.6999999999999997e-303 < k < 0.10000000000000001

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified42.3%

      \[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(10 + k\right)}} \]
    6. Step-by-step derivation
      1. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{{10}^{3} + {k}^{3}}{\color{blue}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \frac{1}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\frac{k}{\color{blue}{\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}}}\right)\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \color{blue}{\left(\frac{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}{{10}^{3} + {k}^{3}}\right)}\right)\right)\right) \]
      5. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{\color{blue}{\frac{{10}^{3} + {k}^{3}}{10 \cdot 10 + \left(k \cdot k - 10 \cdot k\right)}}}\right)\right)\right)\right) \]
      6. flip3-+N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \left(\frac{1}{10 + \color{blue}{k}}\right)\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \color{blue}{\left(10 + k\right)}\right)\right)\right)\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \left(k + \color{blue}{10}\right)\right)\right)\right)\right) \]
      9. +-lowering-+.f6442.3%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(k, \mathsf{/.f64}\left(1, \mathsf{+.f64}\left(k, \color{blue}{10}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr42.3%

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

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

        \[\leadsto a + -10 \cdot \left(k \cdot \color{blue}{a}\right) \]
      2. associate-*r*N/A

        \[\leadsto a + \left(-10 \cdot k\right) \cdot \color{blue}{a} \]
      3. distribute-rgt1-inN/A

        \[\leadsto \left(-10 \cdot k + 1\right) \cdot \color{blue}{a} \]
      4. +-commutativeN/A

        \[\leadsto \left(1 + -10 \cdot k\right) \cdot a \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(1 + -10 \cdot k\right), \color{blue}{a}\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(-10 \cdot k\right)\right), a\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \left(k \cdot -10\right)\right), a\right) \]
      8. *-lowering-*.f6442.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, -10\right)\right), a\right) \]
    10. Simplified42.3%

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

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

Alternative 13: 46.4% accurate, 7.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq -4.7 \cdot 10^{-303}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;k \leq 235000:\\
\;\;\;\;a\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < -4.6999999999999997e-303 or 235000 < k

    1. Initial program 84.2%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified38.4%

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

      \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left({k}^{2}\right)}\right) \]
    7. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(k \cdot \color{blue}{k}\right)\right) \]
      2. *-lowering-*.f6441.5%

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{*.f64}\left(k, \color{blue}{k}\right)\right) \]
    8. Simplified41.5%

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

    if -4.6999999999999997e-303 < k < 235000

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified41.4%

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

      \[\leadsto \color{blue}{a} \]
    7. Step-by-step derivation
      1. Simplified41.3%

        \[\leadsto \color{blue}{a} \]
    8. Recombined 2 regimes into one program.
    9. Add Preprocessing

    Alternative 14: 19.9% accurate, 114.0× speedup?

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

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

      \[\leadsto \color{blue}{\frac{a}{1 + \left(10 \cdot k + {k}^{2}\right)}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \color{blue}{\left(1 + \left(10 \cdot k + {k}^{2}\right)\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(10 \cdot k + k \cdot \color{blue}{k}\right)\right)\right) \]
      3. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \color{blue}{\left(10 + k\right)}\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot 1 + k\right)\right)\right) \]
      5. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + k\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + k\right)\right)\right) \]
      7. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + 1 \cdot \color{blue}{k}\right)\right)\right) \]
      8. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \color{blue}{\left(10 \cdot \frac{1}{k} + 1\right)}\right)\right)\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + k \cdot \left(k \cdot \left(1 + \color{blue}{10 \cdot \frac{1}{k}}\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + \left(k \cdot k\right) \cdot \color{blue}{\left(1 + 10 \cdot \frac{1}{k}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \left(1 + {k}^{2} \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \color{blue}{\left({k}^{2} \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(\left(k \cdot k\right) \cdot \left(\color{blue}{1} + 10 \cdot \frac{1}{k}\right)\right)\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \left(k \cdot \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \color{blue}{\left(k \cdot \left(1 + 10 \cdot \frac{1}{k}\right)\right)}\right)\right)\right) \]
      16. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(k \cdot \left(10 \cdot \frac{1}{k} + \color{blue}{1}\right)\right)\right)\right)\right) \]
      17. distribute-rgt-inN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(\left(10 \cdot \frac{1}{k}\right) \cdot k + \color{blue}{1 \cdot k}\right)\right)\right)\right) \]
      18. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot \left(\frac{1}{k} \cdot k\right) + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      19. lft-mult-inverseN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 \cdot 1 + 1 \cdot k\right)\right)\right)\right) \]
      20. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + \color{blue}{1} \cdot k\right)\right)\right)\right) \]
      21. *-lft-identityN/A

        \[\leadsto \mathsf{/.f64}\left(a, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(k, \left(10 + k\right)\right)\right)\right) \]
    5. Simplified39.4%

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

      \[\leadsto \color{blue}{a} \]
    7. Step-by-step derivation
      1. Simplified16.7%

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

      Reproduce

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