?

Average Accuracy: 96.8% → 99.8%
Time: 16.0s
Precision: binary64
Cost: 45828

?

\[\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)\\ \mathbf{if}\;k \leq 6.8 \cdot 10^{+138}:\\ \;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m}}{t_0} \cdot \frac{a}{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)))))
   (if (<= k 6.8e+138)
     (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k)))
     (* (/ (pow k m) t_0) (/ a 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 tmp;
	if (k <= 6.8e+138) {
		tmp = (a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
	} else {
		tmp = (pow(k, m) / t_0) * (a / 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)))
	tmp = 0.0
	if (k <= 6.8e+138)
		tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k)));
	else
		tmp = Float64(Float64((k ^ m) / t_0) * Float64(a / 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]}, If[LessEqual[k, 6.8e+138], 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] / t$95$0), $MachinePrecision] * N[(a / t$95$0), $MachinePrecision]), $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)\\
\mathbf{if}\;k \leq 6.8 \cdot 10^{+138}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\

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


\end{array}

Error?

Derivation?

  1. Split input into 2 regimes
  2. if k < 6.80000000000000022e138

    1. Initial program 99.8%

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

    if 6.80000000000000022e138 < k

    1. Initial program 84.9%

      \[\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \]
    2. Applied egg-rr99.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]84.9

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

      *-commutative [=>]84.9

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

      add-sqr-sqrt [=>]84.9

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

      times-frac [=>]84.9

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

      +-commutative [=>]84.9

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

      add-sqr-sqrt [=>]84.9

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

      hypot-def [=>]84.9

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

      +-commutative [=>]84.9

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

      *-commutative [=>]84.9

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

      fma-def [=>]84.9

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

      +-commutative [=>]84.9

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

      add-sqr-sqrt [=>]84.9

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

      hypot-def [=>]99.8

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

      +-commutative [=>]99.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 6.8 \cdot 10^{+138}:\\ \;\;\;\;\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}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.6%
Cost39368
\[\begin{array}{l} t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\ t_1 := \sqrt{{k}^{m}}\\ \mathbf{if}\;m \leq -5 \cdot 10^{-20}:\\ \;\;\;\;\frac{a \cdot t_1}{\frac{\mathsf{fma}\left(k, k + 10, 1\right)}{t_1}}\\ \mathbf{elif}\;m \leq 10^{-26}:\\ \;\;\;\;\frac{\frac{a}{t_0}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \end{array} \]
Alternative 2
Accuracy99.7%
Cost7428
\[\begin{array}{l} \mathbf{if}\;k \leq 8.5 \cdot 10^{+138}:\\ \;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m}}{\frac{k}{\frac{a}{k}}}\\ \end{array} \]
Alternative 3
Accuracy99.5%
Cost7300
\[\begin{array}{l} \mathbf{if}\;k \leq 1.6 \cdot 10^{+123}:\\ \;\;\;\;\frac{{k}^{m}}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m}}{\frac{k}{\frac{a}{k}}}\\ \end{array} \]
Alternative 4
Accuracy98.7%
Cost7172
\[\begin{array}{l} \mathbf{if}\;k \leq 10:\\ \;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m}}{\frac{k}{\frac{a}{k}}}\\ \end{array} \]
Alternative 5
Accuracy98.4%
Cost7044
\[\begin{array}{l} \mathbf{if}\;k \leq 1:\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;\frac{{k}^{m}}{\frac{k}{\frac{a}{k}}}\\ \end{array} \]
Alternative 6
Accuracy96.1%
Cost6921
\[\begin{array}{l} \mathbf{if}\;m \leq -3.6 \cdot 10^{-9} \lor \neg \left(m \leq 7 \cdot 10^{-14}\right):\\ \;\;\;\;a \cdot {k}^{m}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \end{array} \]
Alternative 7
Accuracy74.8%
Cost968
\[\begin{array}{l} \mathbf{if}\;m \leq -22000000000000:\\ \;\;\;\;a \cdot \left(\left(1 + \frac{0.1}{k}\right) + -1\right)\\ \mathbf{elif}\;m \leq 1.5 \cdot 10^{+24}:\\ \;\;\;\;\frac{a}{\left(1 + k \cdot 10\right) + k \cdot k}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + a \cdot \frac{0.1}{k}\right) + -1\\ \end{array} \]
Alternative 8
Accuracy69.2%
Cost844
\[\begin{array}{l} \mathbf{if}\;k \leq -1500000000:\\ \;\;\;\;a \cdot \left(\left(1 + \frac{0.1}{k}\right) + -1\right)\\ \mathbf{elif}\;k \leq -1.02 \cdot 10^{-206}:\\ \;\;\;\;\left(1 + a \cdot \frac{0.1}{k}\right) + -1\\ \mathbf{elif}\;k \leq 10:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
Alternative 9
Accuracy74.8%
Cost840
\[\begin{array}{l} \mathbf{if}\;m \leq -22000000000000:\\ \;\;\;\;a \cdot \left(\left(1 + \frac{0.1}{k}\right) + -1\right)\\ \mathbf{elif}\;m \leq 7 \cdot 10^{+23}:\\ \;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + a \cdot \frac{0.1}{k}\right) + -1\\ \end{array} \]
Alternative 10
Accuracy63.3%
Cost712
\[\begin{array}{l} \mathbf{if}\;k \leq -0.43:\\ \;\;\;\;\frac{a}{k \cdot k}\\ \mathbf{elif}\;k \leq 0.1:\\ \;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
Alternative 11
Accuracy63.3%
Cost712
\[\begin{array}{l} \mathbf{if}\;k \leq -0.43:\\ \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\ \mathbf{elif}\;k \leq 0.1:\\ \;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
Alternative 12
Accuracy63.4%
Cost712
\[\begin{array}{l} \mathbf{if}\;k \leq -10:\\ \;\;\;\;\frac{1}{\frac{k \cdot k}{a}}\\ \mathbf{elif}\;k \leq 10:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
Alternative 13
Accuracy66.9%
Cost712
\[\begin{array}{l} \mathbf{if}\;k \leq -0.05:\\ \;\;\;\;a \cdot \left(\left(1 + \frac{0.1}{k}\right) + -1\right)\\ \mathbf{elif}\;k \leq 10:\\ \;\;\;\;\frac{a}{1 + k \cdot 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a}{k}}{k}\\ \end{array} \]
Alternative 14
Accuracy39.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;k \leq -0.1 \lor \neg \left(k \leq 0.1\right):\\ \;\;\;\;a \cdot \frac{0.1}{k}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 15
Accuracy61.6%
Cost585
\[\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 16
Accuracy63.0%
Cost584
\[\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 17
Accuracy27.0%
Cost64
\[a \]

Error

Reproduce?

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