Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.4%
Time: 19.5s
Alternatives: 14
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \end{array} \]
(FPCore (k n)
 :precision binary64
 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
	return (1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
	return (1.0 / Math.sqrt(k)) * Math.pow(((2.0 * Math.PI) * n), ((1.0 - k) / 2.0));
}
def code(k, n):
	return (1.0 / math.sqrt(k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
function code(k, n)
	return Float64(Float64(1.0 / sqrt(k)) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0)))
end
function tmp = code(k, n)
	tmp = (1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0));
end
code[k_, n_] := N[(N[(1.0 / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\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: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \end{array} \]
(FPCore (k n)
 :precision binary64
 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
	return (1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
	return (1.0 / Math.sqrt(k)) * Math.pow(((2.0 * Math.PI) * n), ((1.0 - k) / 2.0));
}
def code(k, n):
	return (1.0 / math.sqrt(k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
function code(k, n)
	return Float64(Float64(1.0 / sqrt(k)) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0)))
end
function tmp = code(k, n)
	tmp = (1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0));
end
code[k_, n_] := N[(N[(1.0 / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}

Alternative 1: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 2 \cdot 10^{-29}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{k \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(k + -1\right)}}}\\ \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (if (<= k 2e-29)
   (* (sqrt (* 2.0 n)) (sqrt (/ PI k)))
   (/ 1.0 (sqrt (* k (pow (* PI (* 2.0 n)) (+ k -1.0)))))))
double code(double k, double n) {
	double tmp;
	if (k <= 2e-29) {
		tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
	} else {
		tmp = 1.0 / sqrt((k * pow((((double) M_PI) * (2.0 * n)), (k + -1.0))));
	}
	return tmp;
}
public static double code(double k, double n) {
	double tmp;
	if (k <= 2e-29) {
		tmp = Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
	} else {
		tmp = 1.0 / Math.sqrt((k * Math.pow((Math.PI * (2.0 * n)), (k + -1.0))));
	}
	return tmp;
}
def code(k, n):
	tmp = 0
	if k <= 2e-29:
		tmp = math.sqrt((2.0 * n)) * math.sqrt((math.pi / k))
	else:
		tmp = 1.0 / math.sqrt((k * math.pow((math.pi * (2.0 * n)), (k + -1.0))))
	return tmp
function code(k, n)
	tmp = 0.0
	if (k <= 2e-29)
		tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k)));
	else
		tmp = Float64(1.0 / sqrt(Float64(k * (Float64(pi * Float64(2.0 * n)) ^ Float64(k + -1.0)))));
	end
	return tmp
end
function tmp_2 = code(k, n)
	tmp = 0.0;
	if (k <= 2e-29)
		tmp = sqrt((2.0 * n)) * sqrt((pi / k));
	else
		tmp = 1.0 / sqrt((k * ((pi * (2.0 * n)) ^ (k + -1.0))));
	end
	tmp_2 = tmp;
end
code[k_, n_] := If[LessEqual[k, 2e-29], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k * N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(k + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{k \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(k + -1\right)}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 1.99999999999999989e-29

    1. Initial program 99.3%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0 78.7%

      \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
    4. Step-by-step derivation
      1. *-commutative78.7%

        \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot n}}{k}} \cdot \sqrt{2} \]
      2. associate-/l*78.7%

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified78.7%

      \[\leadsto \color{blue}{\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}} \]
    6. Step-by-step derivation
      1. *-commutative78.7%

        \[\leadsto \color{blue}{\sqrt{2} \cdot \sqrt{\pi \cdot \frac{n}{k}}} \]
      2. sqrt-unprod79.0%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    7. Applied egg-rr79.0%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    8. Step-by-step derivation
      1. associate-*r/79.0%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
      2. associate-*l/79.0%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{\pi}{k} \cdot n\right)}} \]
      3. associate-*r*79.0%

        \[\leadsto \sqrt{\color{blue}{\left(2 \cdot \frac{\pi}{k}\right) \cdot n}} \]
      4. *-commutative79.0%

        \[\leadsto \sqrt{\color{blue}{n \cdot \left(2 \cdot \frac{\pi}{k}\right)}} \]
      5. associate-*r*79.0%

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
      6. metadata-eval79.0%

        \[\leadsto \sqrt{\left(n \cdot \color{blue}{\frac{1}{0.5}}\right) \cdot \frac{\pi}{k}} \]
      7. div-inv79.0%

        \[\leadsto \sqrt{\color{blue}{\frac{n}{0.5}} \cdot \frac{\pi}{k}} \]
      8. sqrt-prod99.5%

        \[\leadsto \color{blue}{\sqrt{\frac{n}{0.5}} \cdot \sqrt{\frac{\pi}{k}}} \]
      9. div-inv99.5%

        \[\leadsto \sqrt{\color{blue}{n \cdot \frac{1}{0.5}}} \cdot \sqrt{\frac{\pi}{k}} \]
      10. metadata-eval99.5%

        \[\leadsto \sqrt{n \cdot \color{blue}{2}} \cdot \sqrt{\frac{\pi}{k}} \]
    9. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\sqrt{n \cdot 2} \cdot \sqrt{\frac{\pi}{k}}} \]

    if 1.99999999999999989e-29 < k

    1. Initial program 99.9%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0 99.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{k}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    4. Applied egg-rr99.9%

      \[\leadsto \color{blue}{{\left(\frac{k}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}^{-0.5}} \]
    5. Step-by-step derivation
      1. div-inv99.9%

        \[\leadsto {\color{blue}{\left(k \cdot \frac{1}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}}^{-0.5} \]
      2. pow-flip99.9%

        \[\leadsto {\left(k \cdot \color{blue}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(-\left(1 - k\right)\right)}}\right)}^{-0.5} \]
      3. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\color{blue}{\left(\pi \cdot \left(n \cdot 2\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      4. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\left(\pi \cdot \color{blue}{\left(2 \cdot n\right)}\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    6. Applied egg-rr99.9%

      \[\leadsto {\color{blue}{\left(k \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-\left(1 - k\right)\right)}\right)}}^{-0.5} \]
    7. Step-by-step derivation
      1. associate-*r*99.9%

        \[\leadsto {\left(k \cdot {\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      2. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      3. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\color{blue}{\left(n \cdot \left(2 \cdot \pi\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      4. sub-neg99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(1 + \left(-k\right)\right)}\right)}\right)}^{-0.5} \]
      5. +-commutative99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(\left(-k\right) + 1\right)}\right)}\right)}^{-0.5} \]
      6. distribute-neg-in99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\color{blue}{\left(\left(-\left(-k\right)\right) + \left(-1\right)\right)}}\right)}^{-0.5} \]
      7. remove-double-neg99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\color{blue}{k} + \left(-1\right)\right)}\right)}^{-0.5} \]
      8. metadata-eval99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + \color{blue}{-1}\right)}\right)}^{-0.5} \]
    8. Simplified99.9%

      \[\leadsto {\color{blue}{\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}\right)}}^{-0.5} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt99.9%

        \[\leadsto {\color{blue}{\left(\sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}} \cdot \sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}}\right)}}^{-0.5} \]
      2. unpow-prod-down99.9%

        \[\leadsto \color{blue}{{\left(\sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \cdot {\left(\sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5}} \]
      3. *-commutative99.9%

        \[\leadsto {\left(\sqrt{k \cdot {\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(k + -1\right)}}\right)}^{-0.5} \cdot {\left(\sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \]
      4. *-commutative99.9%

        \[\leadsto {\left(\sqrt{k \cdot {\left(\color{blue}{\left(\pi \cdot 2\right)} \cdot n\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \cdot {\left(\sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \]
      5. associate-*l*99.9%

        \[\leadsto {\left(\sqrt{k \cdot {\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(k + -1\right)}}\right)}^{-0.5} \cdot {\left(\sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \]
      6. *-commutative99.9%

        \[\leadsto {\left(\sqrt{k \cdot {\left(\pi \cdot \color{blue}{\left(n \cdot 2\right)}\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \cdot {\left(\sqrt{k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \]
    10. Applied egg-rr99.9%

      \[\leadsto \color{blue}{{\left(\sqrt{k \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5} \cdot {\left(\sqrt{k \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(k + -1\right)}}\right)}^{-0.5}} \]
    11. Step-by-step derivation
      1. pow-sqr99.9%

        \[\leadsto \color{blue}{{\left(\sqrt{k \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(k + -1\right)}}\right)}^{\left(2 \cdot -0.5\right)}} \]
      2. metadata-eval99.9%

        \[\leadsto {\left(\sqrt{k \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(k + -1\right)}}\right)}^{\color{blue}{-1}} \]
      3. unpow-199.9%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{k \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(k + -1\right)}}}} \]
    12. Simplified99.9%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{k \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(k + -1\right)}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.7%

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

Alternative 2: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 2 \cdot 10^{-33}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;{\left(k \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k + -1\right)}\right)}^{-0.5}\\ \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (if (<= k 2e-33)
   (* (sqrt (* 2.0 n)) (sqrt (/ PI k)))
   (pow (* k (pow (* (* 2.0 PI) n) (+ k -1.0))) -0.5)))
double code(double k, double n) {
	double tmp;
	if (k <= 2e-33) {
		tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
	} else {
		tmp = pow((k * pow(((2.0 * ((double) M_PI)) * n), (k + -1.0))), -0.5);
	}
	return tmp;
}
public static double code(double k, double n) {
	double tmp;
	if (k <= 2e-33) {
		tmp = Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
	} else {
		tmp = Math.pow((k * Math.pow(((2.0 * Math.PI) * n), (k + -1.0))), -0.5);
	}
	return tmp;
}
def code(k, n):
	tmp = 0
	if k <= 2e-33:
		tmp = math.sqrt((2.0 * n)) * math.sqrt((math.pi / k))
	else:
		tmp = math.pow((k * math.pow(((2.0 * math.pi) * n), (k + -1.0))), -0.5)
	return tmp
function code(k, n)
	tmp = 0.0
	if (k <= 2e-33)
		tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k)));
	else
		tmp = Float64(k * (Float64(Float64(2.0 * pi) * n) ^ Float64(k + -1.0))) ^ -0.5;
	end
	return tmp
end
function tmp_2 = code(k, n)
	tmp = 0.0;
	if (k <= 2e-33)
		tmp = sqrt((2.0 * n)) * sqrt((pi / k));
	else
		tmp = (k * (((2.0 * pi) * n) ^ (k + -1.0))) ^ -0.5;
	end
	tmp_2 = tmp;
end
code[k_, n_] := If[LessEqual[k, 2e-33], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(k * N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(k + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-33}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\

\mathbf{else}:\\
\;\;\;\;{\left(k \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k + -1\right)}\right)}^{-0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 2.0000000000000001e-33

    1. Initial program 99.3%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0 78.7%

      \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
    4. Step-by-step derivation
      1. *-commutative78.7%

        \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot n}}{k}} \cdot \sqrt{2} \]
      2. associate-/l*78.7%

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified78.7%

      \[\leadsto \color{blue}{\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}} \]
    6. Step-by-step derivation
      1. *-commutative78.7%

        \[\leadsto \color{blue}{\sqrt{2} \cdot \sqrt{\pi \cdot \frac{n}{k}}} \]
      2. sqrt-unprod79.0%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    7. Applied egg-rr79.0%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    8. Step-by-step derivation
      1. associate-*r/79.0%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
      2. associate-*l/79.0%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{\pi}{k} \cdot n\right)}} \]
      3. associate-*r*79.0%

        \[\leadsto \sqrt{\color{blue}{\left(2 \cdot \frac{\pi}{k}\right) \cdot n}} \]
      4. *-commutative79.0%

        \[\leadsto \sqrt{\color{blue}{n \cdot \left(2 \cdot \frac{\pi}{k}\right)}} \]
      5. associate-*r*79.0%

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
      6. metadata-eval79.0%

        \[\leadsto \sqrt{\left(n \cdot \color{blue}{\frac{1}{0.5}}\right) \cdot \frac{\pi}{k}} \]
      7. div-inv79.0%

        \[\leadsto \sqrt{\color{blue}{\frac{n}{0.5}} \cdot \frac{\pi}{k}} \]
      8. sqrt-prod99.5%

        \[\leadsto \color{blue}{\sqrt{\frac{n}{0.5}} \cdot \sqrt{\frac{\pi}{k}}} \]
      9. div-inv99.5%

        \[\leadsto \sqrt{\color{blue}{n \cdot \frac{1}{0.5}}} \cdot \sqrt{\frac{\pi}{k}} \]
      10. metadata-eval99.5%

        \[\leadsto \sqrt{n \cdot \color{blue}{2}} \cdot \sqrt{\frac{\pi}{k}} \]
    9. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\sqrt{n \cdot 2} \cdot \sqrt{\frac{\pi}{k}}} \]

    if 2.0000000000000001e-33 < k

    1. Initial program 99.9%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0 99.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{k}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    4. Applied egg-rr99.9%

      \[\leadsto \color{blue}{{\left(\frac{k}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}^{-0.5}} \]
    5. Step-by-step derivation
      1. div-inv99.9%

        \[\leadsto {\color{blue}{\left(k \cdot \frac{1}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}}^{-0.5} \]
      2. pow-flip99.9%

        \[\leadsto {\left(k \cdot \color{blue}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(-\left(1 - k\right)\right)}}\right)}^{-0.5} \]
      3. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\color{blue}{\left(\pi \cdot \left(n \cdot 2\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      4. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\left(\pi \cdot \color{blue}{\left(2 \cdot n\right)}\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    6. Applied egg-rr99.9%

      \[\leadsto {\color{blue}{\left(k \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-\left(1 - k\right)\right)}\right)}}^{-0.5} \]
    7. Step-by-step derivation
      1. associate-*r*99.9%

        \[\leadsto {\left(k \cdot {\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      2. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      3. *-commutative99.9%

        \[\leadsto {\left(k \cdot {\color{blue}{\left(n \cdot \left(2 \cdot \pi\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
      4. sub-neg99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(1 + \left(-k\right)\right)}\right)}\right)}^{-0.5} \]
      5. +-commutative99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(\left(-k\right) + 1\right)}\right)}\right)}^{-0.5} \]
      6. distribute-neg-in99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\color{blue}{\left(\left(-\left(-k\right)\right) + \left(-1\right)\right)}}\right)}^{-0.5} \]
      7. remove-double-neg99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\color{blue}{k} + \left(-1\right)\right)}\right)}^{-0.5} \]
      8. metadata-eval99.9%

        \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + \color{blue}{-1}\right)}\right)}^{-0.5} \]
    8. Simplified99.9%

      \[\leadsto {\color{blue}{\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}\right)}}^{-0.5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 2 \cdot 10^{-33}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;{\left(k \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k + -1\right)}\right)}^{-0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 4 \cdot 10^{-17}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}\\ \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (if (<= k 4e-17)
   (* (sqrt (* 2.0 n)) (sqrt (/ PI k)))
   (sqrt (/ (pow (* (* 2.0 PI) n) (- 1.0 k)) k))))
double code(double k, double n) {
	double tmp;
	if (k <= 4e-17) {
		tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
	} else {
		tmp = sqrt((pow(((2.0 * ((double) M_PI)) * n), (1.0 - k)) / k));
	}
	return tmp;
}
public static double code(double k, double n) {
	double tmp;
	if (k <= 4e-17) {
		tmp = Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
	} else {
		tmp = Math.sqrt((Math.pow(((2.0 * Math.PI) * n), (1.0 - k)) / k));
	}
	return tmp;
}
def code(k, n):
	tmp = 0
	if k <= 4e-17:
		tmp = math.sqrt((2.0 * n)) * math.sqrt((math.pi / k))
	else:
		tmp = math.sqrt((math.pow(((2.0 * math.pi) * n), (1.0 - k)) / k))
	return tmp
function code(k, n)
	tmp = 0.0
	if (k <= 4e-17)
		tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k)));
	else
		tmp = sqrt(Float64((Float64(Float64(2.0 * pi) * n) ^ Float64(1.0 - k)) / k));
	end
	return tmp
end
function tmp_2 = code(k, n)
	tmp = 0.0;
	if (k <= 4e-17)
		tmp = sqrt((2.0 * n)) * sqrt((pi / k));
	else
		tmp = sqrt(((((2.0 * pi) * n) ^ (1.0 - k)) / k));
	end
	tmp_2 = tmp;
end
code[k_, n_] := If[LessEqual[k, 4e-17], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 4 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if k < 4.00000000000000029e-17

    1. Initial program 99.3%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0 79.1%

      \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
    4. Step-by-step derivation
      1. *-commutative79.1%

        \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot n}}{k}} \cdot \sqrt{2} \]
      2. associate-/l*79.0%

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified79.0%

      \[\leadsto \color{blue}{\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}} \]
    6. Step-by-step derivation
      1. *-commutative79.0%

        \[\leadsto \color{blue}{\sqrt{2} \cdot \sqrt{\pi \cdot \frac{n}{k}}} \]
      2. sqrt-unprod79.4%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    7. Applied egg-rr79.4%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    8. Step-by-step derivation
      1. associate-*r/79.4%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
      2. associate-*l/79.4%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{\pi}{k} \cdot n\right)}} \]
      3. associate-*r*79.4%

        \[\leadsto \sqrt{\color{blue}{\left(2 \cdot \frac{\pi}{k}\right) \cdot n}} \]
      4. *-commutative79.4%

        \[\leadsto \sqrt{\color{blue}{n \cdot \left(2 \cdot \frac{\pi}{k}\right)}} \]
      5. associate-*r*79.4%

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
      6. metadata-eval79.4%

        \[\leadsto \sqrt{\left(n \cdot \color{blue}{\frac{1}{0.5}}\right) \cdot \frac{\pi}{k}} \]
      7. div-inv79.4%

        \[\leadsto \sqrt{\color{blue}{\frac{n}{0.5}} \cdot \frac{\pi}{k}} \]
      8. sqrt-prod99.5%

        \[\leadsto \color{blue}{\sqrt{\frac{n}{0.5}} \cdot \sqrt{\frac{\pi}{k}}} \]
      9. div-inv99.5%

        \[\leadsto \sqrt{\color{blue}{n \cdot \frac{1}{0.5}}} \cdot \sqrt{\frac{\pi}{k}} \]
      10. metadata-eval99.5%

        \[\leadsto \sqrt{n \cdot \color{blue}{2}} \cdot \sqrt{\frac{\pi}{k}} \]
    9. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\sqrt{n \cdot 2} \cdot \sqrt{\frac{\pi}{k}}} \]

    if 4.00000000000000029e-17 < k

    1. Initial program 99.9%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt99.9%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}} \cdot \sqrt{\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}} \]
      2. sqrt-unprod99.9%

        \[\leadsto \color{blue}{\sqrt{\left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)}} \]
      3. *-commutative99.9%

        \[\leadsto \sqrt{\color{blue}{\left({\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right)} \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      4. associate-*r*99.9%

        \[\leadsto \sqrt{\left({\color{blue}{\left(2 \cdot \left(\pi \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      5. div-sub99.9%

        \[\leadsto \sqrt{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      6. metadata-eval99.9%

        \[\leadsto \sqrt{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\color{blue}{0.5} - \frac{k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      7. div-inv99.9%

        \[\leadsto \sqrt{\color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}} \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      8. *-commutative99.9%

        \[\leadsto \sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}} \cdot \color{blue}{\left({\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right)}} \]
    4. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}\right)}^{2}}{k}}} \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(1 - k\right)}}{k}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.7%

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

Alternative 4: 58.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 5.4 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + \mathsf{fma}\left(\pi, 2 \cdot \frac{n}{k}, -1\right)}\\ \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (if (<= k 5.4e+78)
   (* (sqrt (* 2.0 n)) (sqrt (/ PI k)))
   (sqrt (+ 1.0 (fma PI (* 2.0 (/ n k)) -1.0)))))
double code(double k, double n) {
	double tmp;
	if (k <= 5.4e+78) {
		tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
	} else {
		tmp = sqrt((1.0 + fma(((double) M_PI), (2.0 * (n / k)), -1.0)));
	}
	return tmp;
}
function code(k, n)
	tmp = 0.0
	if (k <= 5.4e+78)
		tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k)));
	else
		tmp = sqrt(Float64(1.0 + fma(pi, Float64(2.0 * Float64(n / k)), -1.0)));
	end
	return tmp
end
code[k_, n_] := If[LessEqual[k, 5.4e+78], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(1.0 + N[(Pi * N[(2.0 * N[(n / k), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.4 \cdot 10^{+78}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{1 + \mathsf{fma}\left(\pi, 2 \cdot \frac{n}{k}, -1\right)}\\


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

    1. Initial program 99.4%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0 59.0%

      \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
    4. Step-by-step derivation
      1. *-commutative59.0%

        \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot n}}{k}} \cdot \sqrt{2} \]
      2. associate-/l*59.0%

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified59.0%

      \[\leadsto \color{blue}{\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}} \]
    6. Step-by-step derivation
      1. *-commutative59.0%

        \[\leadsto \color{blue}{\sqrt{2} \cdot \sqrt{\pi \cdot \frac{n}{k}}} \]
      2. sqrt-unprod59.2%

        \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    7. Applied egg-rr59.2%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
    8. Step-by-step derivation
      1. associate-*r/59.2%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
      2. associate-*l/59.2%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{\pi}{k} \cdot n\right)}} \]
      3. associate-*r*59.2%

        \[\leadsto \sqrt{\color{blue}{\left(2 \cdot \frac{\pi}{k}\right) \cdot n}} \]
      4. *-commutative59.2%

        \[\leadsto \sqrt{\color{blue}{n \cdot \left(2 \cdot \frac{\pi}{k}\right)}} \]
      5. associate-*r*59.2%

        \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
      6. metadata-eval59.2%

        \[\leadsto \sqrt{\left(n \cdot \color{blue}{\frac{1}{0.5}}\right) \cdot \frac{\pi}{k}} \]
      7. div-inv59.2%

        \[\leadsto \sqrt{\color{blue}{\frac{n}{0.5}} \cdot \frac{\pi}{k}} \]
      8. sqrt-prod74.0%

        \[\leadsto \color{blue}{\sqrt{\frac{n}{0.5}} \cdot \sqrt{\frac{\pi}{k}}} \]
      9. div-inv74.0%

        \[\leadsto \sqrt{\color{blue}{n \cdot \frac{1}{0.5}}} \cdot \sqrt{\frac{\pi}{k}} \]
      10. metadata-eval74.0%

        \[\leadsto \sqrt{n \cdot \color{blue}{2}} \cdot \sqrt{\frac{\pi}{k}} \]
    9. Applied egg-rr74.0%

      \[\leadsto \color{blue}{\sqrt{n \cdot 2} \cdot \sqrt{\frac{\pi}{k}}} \]

    if 5.40000000000000009e78 < k

    1. Initial program 100.0%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt100.0%

        \[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}} \cdot \sqrt{\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}} \]
      2. sqrt-unprod100.0%

        \[\leadsto \color{blue}{\sqrt{\left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)}} \]
      3. *-commutative100.0%

        \[\leadsto \sqrt{\color{blue}{\left({\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right)} \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      4. associate-*r*100.0%

        \[\leadsto \sqrt{\left({\color{blue}{\left(2 \cdot \left(\pi \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      5. div-sub100.0%

        \[\leadsto \sqrt{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      6. metadata-eval100.0%

        \[\leadsto \sqrt{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\color{blue}{0.5} - \frac{k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      7. div-inv100.0%

        \[\leadsto \sqrt{\color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}} \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
      8. *-commutative100.0%

        \[\leadsto \sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}} \cdot \color{blue}{\left({\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right)}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}\right)}^{2}}{k}}} \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(1 - k\right)}}{k}}} \]
    6. Taylor expanded in k around 0 2.6%

      \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
    7. Step-by-step derivation
      1. associate-*r/2.6%

        \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
      2. associate-*r*2.6%

        \[\leadsto \sqrt{\frac{\color{blue}{\left(2 \cdot n\right) \cdot \pi}}{k}} \]
      3. *-commutative2.6%

        \[\leadsto \sqrt{\frac{\color{blue}{\left(n \cdot 2\right)} \cdot \pi}{k}} \]
      4. associate-*l*2.6%

        \[\leadsto \sqrt{\frac{\color{blue}{n \cdot \left(2 \cdot \pi\right)}}{k}} \]
      5. *-commutative2.6%

        \[\leadsto \sqrt{\frac{n \cdot \color{blue}{\left(\pi \cdot 2\right)}}{k}} \]
      6. associate-/l*2.6%

        \[\leadsto \sqrt{\color{blue}{n \cdot \frac{\pi \cdot 2}{k}}} \]
    8. Simplified2.6%

      \[\leadsto \sqrt{\color{blue}{n \cdot \frac{\pi \cdot 2}{k}}} \]
    9. Step-by-step derivation
      1. clear-num2.6%

        \[\leadsto \sqrt{n \cdot \color{blue}{\frac{1}{\frac{k}{\pi \cdot 2}}}} \]
      2. un-div-inv2.6%

        \[\leadsto \sqrt{\color{blue}{\frac{n}{\frac{k}{\pi \cdot 2}}}} \]
      3. *-un-lft-identity2.6%

        \[\leadsto \sqrt{\frac{n}{\frac{\color{blue}{1 \cdot k}}{\pi \cdot 2}}} \]
      4. *-commutative2.6%

        \[\leadsto \sqrt{\frac{n}{\frac{1 \cdot k}{\color{blue}{2 \cdot \pi}}}} \]
      5. times-frac2.6%

        \[\leadsto \sqrt{\frac{n}{\color{blue}{\frac{1}{2} \cdot \frac{k}{\pi}}}} \]
      6. metadata-eval2.6%

        \[\leadsto \sqrt{\frac{n}{\color{blue}{0.5} \cdot \frac{k}{\pi}}} \]
    10. Applied egg-rr2.6%

      \[\leadsto \sqrt{\color{blue}{\frac{n}{0.5 \cdot \frac{k}{\pi}}}} \]
    11. Step-by-step derivation
      1. associate-/r*2.6%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{n}{0.5}}{\frac{k}{\pi}}}} \]
    12. Simplified2.6%

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{n}{0.5}}{\frac{k}{\pi}}}} \]
    13. Step-by-step derivation
      1. associate-/r/2.6%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{n}{0.5}}{k} \cdot \pi}} \]
      2. associate-*l/2.6%

        \[\leadsto \sqrt{\color{blue}{\frac{\frac{n}{0.5} \cdot \pi}{k}}} \]
      3. div-inv2.6%

        \[\leadsto \sqrt{\frac{\color{blue}{\left(n \cdot \frac{1}{0.5}\right)} \cdot \pi}{k}} \]
      4. metadata-eval2.6%

        \[\leadsto \sqrt{\frac{\left(n \cdot \color{blue}{2}\right) \cdot \pi}{k}} \]
      5. associate-*r*2.6%

        \[\leadsto \sqrt{\frac{\color{blue}{n \cdot \left(2 \cdot \pi\right)}}{k}} \]
      6. *-commutative2.6%

        \[\leadsto \sqrt{\frac{\color{blue}{\left(2 \cdot \pi\right) \cdot n}}{k}} \]
      7. associate-*r/2.6%

        \[\leadsto \sqrt{\color{blue}{\left(2 \cdot \pi\right) \cdot \frac{n}{k}}} \]
      8. expm1-log1p-u2.6%

        \[\leadsto \sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(2 \cdot \pi\right) \cdot \frac{n}{k}\right)\right)}} \]
      9. associate-*r*2.6%

        \[\leadsto \sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}\right)\right)} \]
      10. expm1-undefine27.5%

        \[\leadsto \sqrt{\color{blue}{e^{\mathsf{log1p}\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)} - 1}} \]
    14. Applied egg-rr27.5%

      \[\leadsto \sqrt{\color{blue}{e^{\mathsf{log1p}\left(\pi \cdot \frac{n}{k \cdot 0.5}\right)} - 1}} \]
    15. Step-by-step derivation
      1. log1p-undefine27.5%

        \[\leadsto \sqrt{e^{\color{blue}{\log \left(1 + \pi \cdot \frac{n}{k \cdot 0.5}\right)}} - 1} \]
      2. rem-exp-log27.5%

        \[\leadsto \sqrt{\color{blue}{\left(1 + \pi \cdot \frac{n}{k \cdot 0.5}\right)} - 1} \]
      3. associate-+r-27.5%

        \[\leadsto \sqrt{\color{blue}{1 + \left(\pi \cdot \frac{n}{k \cdot 0.5} - 1\right)}} \]
      4. fma-neg27.5%

        \[\leadsto \sqrt{1 + \color{blue}{\mathsf{fma}\left(\pi, \frac{n}{k \cdot 0.5}, -1\right)}} \]
      5. metadata-eval27.5%

        \[\leadsto \sqrt{1 + \mathsf{fma}\left(\pi, \frac{n}{k \cdot 0.5}, \color{blue}{-1}\right)} \]
      6. *-rgt-identity27.5%

        \[\leadsto \sqrt{1 + \mathsf{fma}\left(\pi, \frac{\color{blue}{n \cdot 1}}{k \cdot 0.5}, -1\right)} \]
      7. times-frac27.5%

        \[\leadsto \sqrt{1 + \mathsf{fma}\left(\pi, \color{blue}{\frac{n}{k} \cdot \frac{1}{0.5}}, -1\right)} \]
      8. metadata-eval27.5%

        \[\leadsto \sqrt{1 + \mathsf{fma}\left(\pi, \frac{n}{k} \cdot \color{blue}{2}, -1\right)} \]
      9. *-commutative27.5%

        \[\leadsto \sqrt{1 + \mathsf{fma}\left(\pi, \color{blue}{2 \cdot \frac{n}{k}}, -1\right)} \]
    16. Simplified27.5%

      \[\leadsto \sqrt{\color{blue}{1 + \mathsf{fma}\left(\pi, 2 \cdot \frac{n}{k}, -1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 5.4 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + \mathsf{fma}\left(\pi, 2 \cdot \frac{n}{k}, -1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{\frac{1}{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \end{array} \]
(FPCore (k n)
 :precision binary64
 (* (sqrt (/ 1.0 k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
	return sqrt((1.0 / k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
	return Math.sqrt((1.0 / k)) * Math.pow(((2.0 * Math.PI) * n), ((1.0 - k) / 2.0));
}
def code(k, n):
	return math.sqrt((1.0 / k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
function code(k, n)
	return Float64(sqrt(Float64(1.0 / k)) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0)))
end
function tmp = code(k, n)
	tmp = sqrt((1.0 / k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0));
end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\frac{1}{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0 99.7%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  4. Add Preprocessing

Alternative 6: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot {k}^{-0.5} \end{array} \]
(FPCore (k n)
 :precision binary64
 (* (pow (* 2.0 (* PI n)) (- 0.5 (* k 0.5))) (pow k -0.5)))
double code(double k, double n) {
	return pow((2.0 * (((double) M_PI) * n)), (0.5 - (k * 0.5))) * pow(k, -0.5);
}
public static double code(double k, double n) {
	return Math.pow((2.0 * (Math.PI * n)), (0.5 - (k * 0.5))) * Math.pow(k, -0.5);
}
def code(k, n):
	return math.pow((2.0 * (math.pi * n)), (0.5 - (k * 0.5))) * math.pow(k, -0.5)
function code(k, n)
	return Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 - Float64(k * 0.5))) * (k ^ -0.5))
end
function tmp = code(k, n)
	tmp = ((2.0 * (pi * n)) ^ (0.5 - (k * 0.5))) * (k ^ -0.5);
end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot {k}^{-0.5}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. associate-*l/99.6%

      \[\leadsto \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
    2. *-lft-identity99.6%

      \[\leadsto \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}{\sqrt{k}} \]
    3. associate-*l*99.6%

      \[\leadsto \frac{{\color{blue}{\left(2 \cdot \left(\pi \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}} \]
    4. div-sub99.6%

      \[\leadsto \frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}}}{\sqrt{k}} \]
    5. metadata-eval99.6%

      \[\leadsto \frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\color{blue}{0.5} - \frac{k}{2}\right)}}{\sqrt{k}} \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. div-inv99.6%

      \[\leadsto \color{blue}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)} \cdot \frac{1}{\sqrt{k}}} \]
    2. div-inv99.6%

      \[\leadsto {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \color{blue}{k \cdot \frac{1}{2}}\right)} \cdot \frac{1}{\sqrt{k}} \]
    3. metadata-eval99.6%

      \[\leadsto {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot \color{blue}{0.5}\right)} \cdot \frac{1}{\sqrt{k}} \]
    4. pow1/299.6%

      \[\leadsto {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot \frac{1}{\color{blue}{{k}^{0.5}}} \]
    5. pow-flip99.7%

      \[\leadsto {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot \color{blue}{{k}^{\left(-0.5\right)}} \]
    6. metadata-eval99.7%

      \[\leadsto {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot {k}^{\color{blue}{-0.5}} \]
  6. Applied egg-rr99.7%

    \[\leadsto \color{blue}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot {k}^{-0.5}} \]
  7. Add Preprocessing

Alternative 7: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}} \end{array} \]
(FPCore (k n)
 :precision binary64
 (/ (pow (* 2.0 (* PI n)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
	return pow((2.0 * (((double) M_PI) * n)), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
	return Math.pow((2.0 * (Math.PI * n)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n):
	return math.pow((2.0 * (math.pi * n)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n)
	return Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k))
end
function tmp = code(k, n)
	tmp = ((2.0 * (pi * n)) ^ (0.5 - (k / 2.0))) / sqrt(k);
end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. associate-*l/99.6%

      \[\leadsto \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
    2. *-lft-identity99.6%

      \[\leadsto \frac{\color{blue}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}}{\sqrt{k}} \]
    3. associate-*l*99.6%

      \[\leadsto \frac{{\color{blue}{\left(2 \cdot \left(\pi \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}} \]
    4. div-sub99.6%

      \[\leadsto \frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}}}{\sqrt{k}} \]
    5. metadata-eval99.6%

      \[\leadsto \frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\color{blue}{0.5} - \frac{k}{2}\right)}}{\sqrt{k}} \]
  3. Simplified99.6%

    \[\leadsto \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 8: 48.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}} \end{array} \]
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 n)) (sqrt (/ PI k))))
double code(double k, double n) {
	return sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
}
public static double code(double k, double n) {
	return Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
}
def code(k, n):
	return math.sqrt((2.0 * n)) * math.sqrt((math.pi / k))
function code(k, n)
	return Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k)))
end
function tmp = code(k, n)
	tmp = sqrt((2.0 * n)) * sqrt((pi / k));
end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0 38.7%

    \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
  4. Step-by-step derivation
    1. *-commutative38.7%

      \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot n}}{k}} \cdot \sqrt{2} \]
    2. associate-/l*38.7%

      \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
  5. Simplified38.7%

    \[\leadsto \color{blue}{\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}} \]
  6. Step-by-step derivation
    1. *-commutative38.7%

      \[\leadsto \color{blue}{\sqrt{2} \cdot \sqrt{\pi \cdot \frac{n}{k}}} \]
    2. sqrt-unprod38.9%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
  7. Applied egg-rr38.9%

    \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
  8. Step-by-step derivation
    1. associate-*r/38.9%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi \cdot n}{k}}} \]
    2. associate-*l/38.9%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{\pi}{k} \cdot n\right)}} \]
    3. associate-*r*38.9%

      \[\leadsto \sqrt{\color{blue}{\left(2 \cdot \frac{\pi}{k}\right) \cdot n}} \]
    4. *-commutative38.9%

      \[\leadsto \sqrt{\color{blue}{n \cdot \left(2 \cdot \frac{\pi}{k}\right)}} \]
    5. associate-*r*38.9%

      \[\leadsto \sqrt{\color{blue}{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
    6. metadata-eval38.9%

      \[\leadsto \sqrt{\left(n \cdot \color{blue}{\frac{1}{0.5}}\right) \cdot \frac{\pi}{k}} \]
    7. div-inv38.9%

      \[\leadsto \sqrt{\color{blue}{\frac{n}{0.5}} \cdot \frac{\pi}{k}} \]
    8. sqrt-prod48.3%

      \[\leadsto \color{blue}{\sqrt{\frac{n}{0.5}} \cdot \sqrt{\frac{\pi}{k}}} \]
    9. div-inv48.3%

      \[\leadsto \sqrt{\color{blue}{n \cdot \frac{1}{0.5}}} \cdot \sqrt{\frac{\pi}{k}} \]
    10. metadata-eval48.3%

      \[\leadsto \sqrt{n \cdot \color{blue}{2}} \cdot \sqrt{\frac{\pi}{k}} \]
  9. Applied egg-rr48.3%

    \[\leadsto \color{blue}{\sqrt{n \cdot 2} \cdot \sqrt{\frac{\pi}{k}}} \]
  10. Final simplification48.3%

    \[\leadsto \sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}} \]
  11. Add Preprocessing

Alternative 9: 48.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}} \end{array} \]
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* PI (/ 2.0 k)))))
double code(double k, double n) {
	return sqrt(n) * sqrt((((double) M_PI) * (2.0 / k)));
}
public static double code(double k, double n) {
	return Math.sqrt(n) * Math.sqrt((Math.PI * (2.0 / k)));
}
def code(k, n):
	return math.sqrt(n) * math.sqrt((math.pi * (2.0 / k)))
function code(k, n)
	return Float64(sqrt(n) * sqrt(Float64(pi * Float64(2.0 / k))))
end
function tmp = code(k, n)
	tmp = sqrt(n) * sqrt((pi * (2.0 / k)));
end
code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt99.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}} \cdot \sqrt{\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}} \]
    2. sqrt-unprod90.1%

      \[\leadsto \color{blue}{\sqrt{\left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)}} \]
    3. *-commutative90.1%

      \[\leadsto \sqrt{\color{blue}{\left({\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right)} \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
    4. associate-*r*90.1%

      \[\leadsto \sqrt{\left({\color{blue}{\left(2 \cdot \left(\pi \cdot n\right)\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
    5. div-sub90.1%

      \[\leadsto \sqrt{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
    6. metadata-eval90.1%

      \[\leadsto \sqrt{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\color{blue}{0.5} - \frac{k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right) \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
    7. div-inv90.1%

      \[\leadsto \sqrt{\color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}} \cdot \left(\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\right)} \]
    8. *-commutative90.1%

      \[\leadsto \sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}} \cdot \color{blue}{\left({\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \frac{1}{\sqrt{k}}\right)}} \]
  4. Applied egg-rr90.2%

    \[\leadsto \color{blue}{\sqrt{\frac{{\left({\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}\right)}^{2}}{k}}} \]
  5. Simplified90.3%

    \[\leadsto \color{blue}{\sqrt{\frac{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(1 - k\right)}}{k}}} \]
  6. Taylor expanded in k around 0 38.9%

    \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{n \cdot \pi}{k}}} \]
  7. Step-by-step derivation
    1. associate-*r/38.9%

      \[\leadsto \sqrt{\color{blue}{\frac{2 \cdot \left(n \cdot \pi\right)}{k}}} \]
    2. associate-*r*38.9%

      \[\leadsto \sqrt{\frac{\color{blue}{\left(2 \cdot n\right) \cdot \pi}}{k}} \]
    3. *-commutative38.9%

      \[\leadsto \sqrt{\frac{\color{blue}{\left(n \cdot 2\right)} \cdot \pi}{k}} \]
    4. associate-*l*38.9%

      \[\leadsto \sqrt{\frac{\color{blue}{n \cdot \left(2 \cdot \pi\right)}}{k}} \]
    5. *-commutative38.9%

      \[\leadsto \sqrt{\frac{n \cdot \color{blue}{\left(\pi \cdot 2\right)}}{k}} \]
    6. associate-/l*38.9%

      \[\leadsto \sqrt{\color{blue}{n \cdot \frac{\pi \cdot 2}{k}}} \]
  8. Simplified38.9%

    \[\leadsto \sqrt{\color{blue}{n \cdot \frac{\pi \cdot 2}{k}}} \]
  9. Step-by-step derivation
    1. sqrt-prod48.3%

      \[\leadsto \color{blue}{\sqrt{n} \cdot \sqrt{\frac{\pi \cdot 2}{k}}} \]
    2. *-commutative48.3%

      \[\leadsto \sqrt{n} \cdot \sqrt{\frac{\color{blue}{2 \cdot \pi}}{k}} \]
    3. *-un-lft-identity48.3%

      \[\leadsto \sqrt{n} \cdot \sqrt{\frac{2 \cdot \pi}{\color{blue}{1 \cdot k}}} \]
    4. times-frac48.3%

      \[\leadsto \sqrt{n} \cdot \sqrt{\color{blue}{\frac{2}{1} \cdot \frac{\pi}{k}}} \]
    5. metadata-eval48.3%

      \[\leadsto \sqrt{n} \cdot \sqrt{\color{blue}{2} \cdot \frac{\pi}{k}} \]
  10. Applied egg-rr48.3%

    \[\leadsto \color{blue}{\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}} \]
  11. Step-by-step derivation
    1. associate-*r/48.3%

      \[\leadsto \sqrt{n} \cdot \sqrt{\color{blue}{\frac{2 \cdot \pi}{k}}} \]
    2. *-commutative48.3%

      \[\leadsto \sqrt{n} \cdot \sqrt{\frac{\color{blue}{\pi \cdot 2}}{k}} \]
    3. associate-*r/48.3%

      \[\leadsto \sqrt{n} \cdot \sqrt{\color{blue}{\pi \cdot \frac{2}{k}}} \]
  12. Simplified48.3%

    \[\leadsto \color{blue}{\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}} \]
  13. Add Preprocessing

Alternative 10: 37.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {\left(\frac{k \cdot 0.5}{\pi \cdot n}\right)}^{-0.5} \end{array} \]
(FPCore (k n) :precision binary64 (pow (/ (* k 0.5) (* PI n)) -0.5))
double code(double k, double n) {
	return pow(((k * 0.5) / (((double) M_PI) * n)), -0.5);
}
public static double code(double k, double n) {
	return Math.pow(((k * 0.5) / (Math.PI * n)), -0.5);
}
def code(k, n):
	return math.pow(((k * 0.5) / (math.pi * n)), -0.5)
function code(k, n)
	return Float64(Float64(k * 0.5) / Float64(pi * n)) ^ -0.5
end
function tmp = code(k, n)
	tmp = ((k * 0.5) / (pi * n)) ^ -0.5;
end
code[k_, n_] := N[Power[N[(N[(k * 0.5), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}

\\
{\left(\frac{k \cdot 0.5}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0 99.7%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  4. Applied egg-rr91.1%

    \[\leadsto \color{blue}{{\left(\frac{k}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}^{-0.5}} \]
  5. Taylor expanded in k around 0 39.6%

    \[\leadsto {\color{blue}{\left(0.5 \cdot \frac{k}{n \cdot \pi}\right)}}^{-0.5} \]
  6. Step-by-step derivation
    1. associate-*r/39.6%

      \[\leadsto {\color{blue}{\left(\frac{0.5 \cdot k}{n \cdot \pi}\right)}}^{-0.5} \]
    2. *-commutative39.6%

      \[\leadsto {\left(\frac{\color{blue}{k \cdot 0.5}}{n \cdot \pi}\right)}^{-0.5} \]
  7. Simplified39.6%

    \[\leadsto {\color{blue}{\left(\frac{k \cdot 0.5}{n \cdot \pi}\right)}}^{-0.5} \]
  8. Final simplification39.6%

    \[\leadsto {\left(\frac{k \cdot 0.5}{\pi \cdot n}\right)}^{-0.5} \]
  9. Add Preprocessing

Alternative 11: 37.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {\left(k \cdot \frac{\frac{0.5}{n}}{\pi}\right)}^{-0.5} \end{array} \]
(FPCore (k n) :precision binary64 (pow (* k (/ (/ 0.5 n) PI)) -0.5))
double code(double k, double n) {
	return pow((k * ((0.5 / n) / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
	return Math.pow((k * ((0.5 / n) / Math.PI)), -0.5);
}
def code(k, n):
	return math.pow((k * ((0.5 / n) / math.pi)), -0.5)
function code(k, n)
	return Float64(k * Float64(Float64(0.5 / n) / pi)) ^ -0.5
end
function tmp = code(k, n)
	tmp = (k * ((0.5 / n) / pi)) ^ -0.5;
end
code[k_, n_] := N[Power[N[(k * N[(N[(0.5 / n), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}

\\
{\left(k \cdot \frac{\frac{0.5}{n}}{\pi}\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0 99.7%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  4. Applied egg-rr91.1%

    \[\leadsto \color{blue}{{\left(\frac{k}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}^{-0.5}} \]
  5. Step-by-step derivation
    1. div-inv91.0%

      \[\leadsto {\color{blue}{\left(k \cdot \frac{1}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}}^{-0.5} \]
    2. pow-flip91.0%

      \[\leadsto {\left(k \cdot \color{blue}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(-\left(1 - k\right)\right)}}\right)}^{-0.5} \]
    3. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\color{blue}{\left(\pi \cdot \left(n \cdot 2\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    4. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\left(\pi \cdot \color{blue}{\left(2 \cdot n\right)}\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
  6. Applied egg-rr91.0%

    \[\leadsto {\color{blue}{\left(k \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-\left(1 - k\right)\right)}\right)}}^{-0.5} \]
  7. Step-by-step derivation
    1. associate-*r*91.0%

      \[\leadsto {\left(k \cdot {\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    2. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    3. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\color{blue}{\left(n \cdot \left(2 \cdot \pi\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    4. sub-neg91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(1 + \left(-k\right)\right)}\right)}\right)}^{-0.5} \]
    5. +-commutative91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(\left(-k\right) + 1\right)}\right)}\right)}^{-0.5} \]
    6. distribute-neg-in91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\color{blue}{\left(\left(-\left(-k\right)\right) + \left(-1\right)\right)}}\right)}^{-0.5} \]
    7. remove-double-neg91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\color{blue}{k} + \left(-1\right)\right)}\right)}^{-0.5} \]
    8. metadata-eval91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + \color{blue}{-1}\right)}\right)}^{-0.5} \]
  8. Simplified91.0%

    \[\leadsto {\color{blue}{\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}\right)}}^{-0.5} \]
  9. Taylor expanded in k around 0 39.6%

    \[\leadsto {\left(k \cdot \color{blue}{\frac{0.5}{n \cdot \pi}}\right)}^{-0.5} \]
  10. Step-by-step derivation
    1. associate-/r*39.6%

      \[\leadsto {\left(k \cdot \color{blue}{\frac{\frac{0.5}{n}}{\pi}}\right)}^{-0.5} \]
  11. Simplified39.6%

    \[\leadsto {\left(k \cdot \color{blue}{\frac{\frac{0.5}{n}}{\pi}}\right)}^{-0.5} \]
  12. Add Preprocessing

Alternative 12: 37.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ {\left(k \cdot \frac{0.5}{\pi \cdot n}\right)}^{-0.5} \end{array} \]
(FPCore (k n) :precision binary64 (pow (* k (/ 0.5 (* PI n))) -0.5))
double code(double k, double n) {
	return pow((k * (0.5 / (((double) M_PI) * n))), -0.5);
}
public static double code(double k, double n) {
	return Math.pow((k * (0.5 / (Math.PI * n))), -0.5);
}
def code(k, n):
	return math.pow((k * (0.5 / (math.pi * n))), -0.5)
function code(k, n)
	return Float64(k * Float64(0.5 / Float64(pi * n))) ^ -0.5
end
function tmp = code(k, n)
	tmp = (k * (0.5 / (pi * n))) ^ -0.5;
end
code[k_, n_] := N[Power[N[(k * N[(0.5 / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}

\\
{\left(k \cdot \frac{0.5}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0 99.7%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  4. Applied egg-rr91.1%

    \[\leadsto \color{blue}{{\left(\frac{k}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}^{-0.5}} \]
  5. Step-by-step derivation
    1. div-inv91.0%

      \[\leadsto {\color{blue}{\left(k \cdot \frac{1}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}}^{-0.5} \]
    2. pow-flip91.0%

      \[\leadsto {\left(k \cdot \color{blue}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(-\left(1 - k\right)\right)}}\right)}^{-0.5} \]
    3. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\color{blue}{\left(\pi \cdot \left(n \cdot 2\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    4. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\left(\pi \cdot \color{blue}{\left(2 \cdot n\right)}\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
  6. Applied egg-rr91.0%

    \[\leadsto {\color{blue}{\left(k \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(-\left(1 - k\right)\right)}\right)}}^{-0.5} \]
  7. Step-by-step derivation
    1. associate-*r*91.0%

      \[\leadsto {\left(k \cdot {\color{blue}{\left(\left(\pi \cdot 2\right) \cdot n\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    2. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\left(\color{blue}{\left(2 \cdot \pi\right)} \cdot n\right)}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    3. *-commutative91.0%

      \[\leadsto {\left(k \cdot {\color{blue}{\left(n \cdot \left(2 \cdot \pi\right)\right)}}^{\left(-\left(1 - k\right)\right)}\right)}^{-0.5} \]
    4. sub-neg91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(1 + \left(-k\right)\right)}\right)}\right)}^{-0.5} \]
    5. +-commutative91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\color{blue}{\left(\left(-k\right) + 1\right)}\right)}\right)}^{-0.5} \]
    6. distribute-neg-in91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\color{blue}{\left(\left(-\left(-k\right)\right) + \left(-1\right)\right)}}\right)}^{-0.5} \]
    7. remove-double-neg91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\color{blue}{k} + \left(-1\right)\right)}\right)}^{-0.5} \]
    8. metadata-eval91.0%

      \[\leadsto {\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + \color{blue}{-1}\right)}\right)}^{-0.5} \]
  8. Simplified91.0%

    \[\leadsto {\color{blue}{\left(k \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(k + -1\right)}\right)}}^{-0.5} \]
  9. Taylor expanded in k around 0 39.6%

    \[\leadsto {\left(k \cdot \color{blue}{\frac{0.5}{n \cdot \pi}}\right)}^{-0.5} \]
  10. Final simplification39.6%

    \[\leadsto {\left(k \cdot \frac{0.5}{\pi \cdot n}\right)}^{-0.5} \]
  11. Add Preprocessing

Alternative 13: 36.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \sqrt{2 \cdot \frac{\pi}{\frac{k}{n}}} \end{array} \]
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ PI (/ k n)))))
double code(double k, double n) {
	return sqrt((2.0 * (((double) M_PI) / (k / n))));
}
public static double code(double k, double n) {
	return Math.sqrt((2.0 * (Math.PI / (k / n))));
}
def code(k, n):
	return math.sqrt((2.0 * (math.pi / (k / n))))
function code(k, n)
	return sqrt(Float64(2.0 * Float64(pi / Float64(k / n))))
end
function tmp = code(k, n)
	tmp = sqrt((2.0 * (pi / (k / n))));
end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(Pi / N[(k / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{2 \cdot \frac{\pi}{\frac{k}{n}}}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0 38.7%

    \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
  4. Step-by-step derivation
    1. *-commutative38.7%

      \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot n}}{k}} \cdot \sqrt{2} \]
    2. associate-/l*38.7%

      \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
  5. Simplified38.7%

    \[\leadsto \color{blue}{\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}} \]
  6. Step-by-step derivation
    1. *-commutative38.7%

      \[\leadsto \color{blue}{\sqrt{2} \cdot \sqrt{\pi \cdot \frac{n}{k}}} \]
    2. sqrt-unprod38.9%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
  7. Applied egg-rr38.9%

    \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
  8. Step-by-step derivation
    1. clear-num38.9%

      \[\leadsto \sqrt{2 \cdot \left(\pi \cdot \color{blue}{\frac{1}{\frac{k}{n}}}\right)} \]
    2. un-div-inv38.9%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi}{\frac{k}{n}}}} \]
  9. Applied egg-rr38.9%

    \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{\pi}{\frac{k}{n}}}} \]
  10. Add Preprocessing

Alternative 14: 36.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)} \end{array} \]
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (* PI (/ n k)))))
double code(double k, double n) {
	return sqrt((2.0 * (((double) M_PI) * (n / k))));
}
public static double code(double k, double n) {
	return Math.sqrt((2.0 * (Math.PI * (n / k))));
}
def code(k, n):
	return math.sqrt((2.0 * (math.pi * (n / k))))
function code(k, n)
	return sqrt(Float64(2.0 * Float64(pi * Float64(n / k))))
end
function tmp = code(k, n)
	tmp = sqrt((2.0 * (pi * (n / k))));
end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}
\end{array}
Derivation
  1. Initial program 99.6%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0 38.7%

    \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
  4. Step-by-step derivation
    1. *-commutative38.7%

      \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot n}}{k}} \cdot \sqrt{2} \]
    2. associate-/l*38.7%

      \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
  5. Simplified38.7%

    \[\leadsto \color{blue}{\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}} \]
  6. Step-by-step derivation
    1. *-commutative38.7%

      \[\leadsto \color{blue}{\sqrt{2} \cdot \sqrt{\pi \cdot \frac{n}{k}}} \]
    2. sqrt-unprod38.9%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
  7. Applied egg-rr38.9%

    \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024097 
(FPCore (k n)
  :name "Migdal et al, Equation (51)"
  :precision binary64
  (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))