Average Error: 2.1 → 0.3
Time: 6.0s
Precision: binary64
\[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
\[\begin{array}{l} t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\ t_1 := {k}^{m} \cdot a\\ \mathbf{if}\;m \leq -1 \cdot 10^{-108}:\\ \;\;\;\;{\left(\frac{1}{t_1} + \frac{k}{a} \cdot \frac{k}{{k}^{m}}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t_1}{t_0}}{t_0}\\ \end{array} \]
(FPCore (a k m)
 :precision binary64
 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
(FPCore (a k m)
 :precision binary64
 (let* ((t_0 (hypot k (sqrt (fma k 10.0 1.0)))) (t_1 (* (pow k m) a)))
   (if (<= m -1e-108)
     (pow (+ (/ 1.0 t_1) (* (/ k a) (/ k (pow k m)))) -1.0)
     (/ (/ t_1 t_0) t_0))))
double code(double a, double k, double m) {
	return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
double code(double a, double k, double m) {
	double t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
	double t_1 = pow(k, m) * a;
	double tmp;
	if (m <= -1e-108) {
		tmp = pow(((1.0 / t_1) + ((k / a) * (k / pow(k, m)))), -1.0);
	} else {
		tmp = (t_1 / t_0) / t_0;
	}
	return tmp;
}
function code(a, k, m)
	return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k)))
end
function code(a, k, m)
	t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)))
	t_1 = Float64((k ^ m) * a)
	tmp = 0.0
	if (m <= -1e-108)
		tmp = Float64(Float64(1.0 / t_1) + Float64(Float64(k / a) * Float64(k / (k ^ m)))) ^ -1.0;
	else
		tmp = Float64(Float64(t_1 / t_0) / t_0);
	end
	return tmp
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]
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -1e-108], N[Power[N[(N[(1.0 / t$95$1), $MachinePrecision] + N[(N[(k / a), $MachinePrecision] * N[(k / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[(N[(t$95$1 / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
t_1 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -1 \cdot 10^{-108}:\\
\;\;\;\;{\left(\frac{1}{t_1} + \frac{k}{a} \cdot \frac{k}{{k}^{m}}\right)}^{-1}\\

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


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if m < -1.00000000000000004e-108

    1. Initial program 1.2

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Applied egg-rr1.3

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

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

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

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

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

    if -1.00000000000000004e-108 < m

    1. Initial program 2.5

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Applied egg-rr2.7

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

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

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

Reproduce

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