Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.5%
Time: 19.2s
Alternatives: 7
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 7 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.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{\sqrt{t_0}}{\sqrt{k} \cdot {t_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\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. unpow-prod-down67.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot 0.5\right)}}} \]
  4. Final simplification99.7%

    \[\leadsto \frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(k \cdot 0.5\right)}} \]

Alternative 2: 98.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.7 \cdot 10^{-77}:\\
\;\;\;\;\sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \frac{n}{0.5}}\\

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


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

    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. Step-by-step derivation
      1. *-commutative99.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot \left(n \cdot 2\right)}}{k}} \]
    7. Step-by-step derivation
      1. pow1/267.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \left(2 \cdot n\right)}} \]
      3. /-rgt-identity99.4%

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

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

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

        \[\leadsto \sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \frac{n}{\color{blue}{0.5}}} \]
    10. Simplified99.4%

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

    if 5.69999999999999981e-77 < k

    1. Initial program 99.7%

      \[\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. *-commutative99.7%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.4% accurate, 1.0× speedup?

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

\\
\frac{{\left(n \cdot \left(2 \cdot \pi\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. sqr-pow99.5%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}} \]

Alternative 4: 49.9% accurate, 1.0× speedup?

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

\\
\sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \frac{n}{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. *-commutative99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot \left(n \cdot 2\right)}}{k}} \]
  7. Step-by-step derivation
    1. pow1/232.5%

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

      \[\leadsto {\color{blue}{\left(\left(\pi \cdot \left(n \cdot 2\right)\right) \cdot \frac{1}{k}\right)}}^{0.5} \]
    3. unpow-prod-down43.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \frac{n}{\color{blue}{0.5}}} \]
  10. Simplified43.1%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \frac{n}{0.5}}} \]
  11. Final simplification43.1%

    \[\leadsto \sqrt{\frac{1}{k}} \cdot \sqrt{\pi \cdot \frac{n}{0.5}} \]

Alternative 5: 49.9% accurate, 1.0× speedup?

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

\\
\frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n + 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. Step-by-step derivation
    1. *-commutative99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{\sqrt{\frac{k}{\pi \cdot \frac{n}{0.5}}}}} \]
  11. Step-by-step derivation
    1. div-inv32.5%

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{2 \cdot n}}}} \]
  13. Step-by-step derivation
    1. rem-log-exp3.8%

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

      \[\leadsto \frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{\color{blue}{\log \left({\left(e^{n}\right)}^{2}\right)}}}} \]
    3. unpow23.8%

      \[\leadsto \frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{\log \color{blue}{\left(e^{n} \cdot e^{n}\right)}}}} \]
    4. prod-exp3.9%

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

      \[\leadsto \frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{\color{blue}{n + n}}}} \]
  14. Simplified43.1%

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n + n}}}} \]
  15. Final simplification43.1%

    \[\leadsto \frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n + n}}} \]

Alternative 6: 49.9% accurate, 1.0× speedup?

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

\\
\frac{\sqrt{\pi \cdot \frac{n}{0.5}}}{\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. *-commutative99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{2} \cdot \sqrt{n \cdot \pi}}}{1 \cdot \sqrt{k}} \]
    7. add-sqr-sqrt42.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{2} \cdot \sqrt{n \cdot \pi}} \cdot \sqrt{\sqrt{2} \cdot \sqrt{n \cdot \pi}}}}{1 \cdot \sqrt{k}} \]
    8. times-frac43.0%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\pi \cdot \frac{n}{\color{blue}{0.5}}}}{\sqrt{k}} \]
  10. Simplified43.1%

    \[\leadsto \color{blue}{\frac{\sqrt{\pi \cdot \frac{n}{0.5}}}{\sqrt{k}}} \]
  11. Final simplification43.1%

    \[\leadsto \frac{\sqrt{\pi \cdot \frac{n}{0.5}}}{\sqrt{k}} \]

Alternative 7: 38.3% accurate, 1.5× speedup?

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

\\
\sqrt{2 \cdot \left(n \cdot \frac{\pi}{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. Step-by-step derivation
    1. *-commutative99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sqrt{\frac{\color{blue}{\pi \cdot \left(n \cdot 2\right)}}{k}} \]
  7. Taylor expanded in n around 0 32.5%

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

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

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

    \[\leadsto \sqrt{\color{blue}{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
  10. Taylor expanded in n around 0 32.5%

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

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

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

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

    \[\leadsto \sqrt{2 \cdot \color{blue}{\left(n \cdot \frac{\pi}{k}\right)}} \]
  13. Final simplification32.6%

    \[\leadsto \sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)} \]

Reproduce

?
herbie shell --seed 2023275 
(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))))