?

Average Error: 97.1% → 99.9%
Time: 23.4s
Precision: binary64
Cost: 26436.00

?

\[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
\[\begin{array}{l} \mathbf{if}\;k \leq 2 \cdot 10^{+123}:\\ \;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)} \cdot \frac{a}{k}\\ \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
 (if (<= k 2e+123)
   (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k)))
   (* (/ (pow k m) (hypot k (sqrt (fma k 10.0 1.0)))) (/ a k))))
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 tmp;
	if (k <= 2e+123) {
		tmp = (a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
	} else {
		tmp = (pow(k, m) / hypot(k, sqrt(fma(k, 10.0, 1.0)))) * (a / k);
	}
	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)
	tmp = 0.0
	if (k <= 2e+123)
		tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k)));
	else
		tmp = Float64(Float64((k ^ m) / hypot(k, sqrt(fma(k, 10.0, 1.0)))) * Float64(a / k));
	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_] := If[LessEqual[k, 2e+123], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{+123}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\

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


\end{array}

Error?

Derivation?

  1. Split input into 2 regimes
  2. if k < 1.99999999999999996e123

    1. Initial program 99.9

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

    if 1.99999999999999996e123 < k

    1. Initial program 87.5

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

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

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

      [Start]99.7

      \[ \frac{1}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)} \cdot \frac{{k}^{m}}{\frac{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)}{a}} \]

      associate-*l/ [=>]99.7

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

      *-lft-identity [=>]99.7

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

      associate-/r/ [=>]99.7

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

      associate-*r/ [<=]99.8

      \[ \color{blue}{\frac{{k}^{m}}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)} \cdot \frac{a}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)}} \]
    4. Taylor expanded in k around inf 99.8

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

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

Alternatives

Alternative 1
Error99.6%
Cost19972.00
\[\begin{array}{l} \mathbf{if}\;k \leq 5 \cdot 10^{+91}:\\ \;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\frac{k}{\frac{a}{k}}}{e^{m \cdot \log k}}\right)}^{-1}\\ \end{array} \]
Alternative 2
Error97.1%
Cost7296.00
\[\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \]
Alternative 3
Error96.0%
Cost6921.00
\[\begin{array}{l} \mathbf{if}\;m \leq -0.019 \lor \neg \left(m \leq 4.3 \cdot 10^{-19}\right):\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \end{array} \]
Alternative 4
Error74.8%
Cost2504.00
\[\begin{array}{l} t_0 := \frac{-1}{a} + \left(k + 10\right) \cdot \frac{k}{a}\\ \mathbf{if}\;m \leq -9.5 \cdot 10^{+32}:\\ \;\;\;\;-1 + \left(1 + \frac{a}{k \cdot k}\right)\\ \mathbf{elif}\;m \leq 0.85:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{-1}{t_0 \cdot \frac{-1 + k \cdot \left(-10 - k\right)}{a}}\\ \end{array} \]
Alternative 5
Error74.6%
Cost1224.00
\[\begin{array}{l} \mathbf{if}\;m \leq -9.5 \cdot 10^{+32}:\\ \;\;\;\;-1 + \left(1 + \frac{a}{k \cdot k}\right)\\ \mathbf{elif}\;m \leq 140:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\left(k \cdot a\right) \cdot \left(-10 - k\right) - a} \cdot \left(a \cdot a\right)\\ \end{array} \]
Alternative 6
Error70.1%
Cost841.00
\[\begin{array}{l} \mathbf{if}\;m \leq -2 \cdot 10^{+38} \lor \neg \left(m \leq 1.35 \cdot 10^{+15}\right):\\ \;\;\;\;-1 + \left(1 + \frac{a}{k \cdot k}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{1 + k \cdot k}\\ \end{array} \]
Alternative 7
Error71.4%
Cost841.00
\[\begin{array}{l} \mathbf{if}\;m \leq -9.5 \cdot 10^{+32} \lor \neg \left(m \leq 1.35 \cdot 10^{+15}\right):\\ \;\;\;\;-1 + \left(1 + \frac{a}{k \cdot k}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \end{array} \]
Alternative 8
Error64.4%
Cost712.00
\[\begin{array}{l} \mathbf{if}\;k \leq -10:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 10:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
Alternative 9
Error63.3%
Cost585.00
\[\begin{array}{l} \mathbf{if}\;k \leq -1 \lor \neg \left(k \leq 1\right):\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 10
Error64.1%
Cost584.00
\[\begin{array}{l} \mathbf{if}\;k \leq -1:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 1:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
Alternative 11
Error63.3%
Cost448.00
\[\frac{a}{1 + k \cdot k} \]
Alternative 12
Error27.4%
Cost64.00
\[a \]

Error

Reproduce?

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