Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.5%
Time: 14.2s
Alternatives: 6
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 6 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, 1.0× speedup?

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

\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - 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. *-commutative99.6%

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

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

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

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

Alternative 2: 98.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := n \cdot \left(\pi \cdot 2\right)\\
\mathbf{if}\;k \leq 5 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{t_0}}{\sqrt{k}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t_0}^{\left(1 - k\right)}}{k}}\\


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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def60.8%

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e-85 < k

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def98.4%

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

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

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

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

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

Alternative 3: 51.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.3 \cdot 10^{+181}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\

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


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

    1. Initial program 99.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def82.0%

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

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

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

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

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

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

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

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

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

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

    if 1.3e181 < 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. Step-by-step derivation
      1. *-commutative100.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
    4. Step-by-step derivation
      1. expm1-def100.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{\pi}{\frac{k}{n}}}} \]
    12. Step-by-step derivation
      1. pow1/22.5%

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

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

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

        \[\leadsto {\left(\frac{\left(2 \cdot \pi\right) \cdot n}{k}\right)}^{\color{blue}{\left(0.25 + 0.25\right)}} \]
      5. pow-prod-up2.5%

        \[\leadsto \color{blue}{{\left(\frac{\left(2 \cdot \pi\right) \cdot n}{k}\right)}^{0.25} \cdot {\left(\frac{\left(2 \cdot \pi\right) \cdot n}{k}\right)}^{0.25}} \]
      6. pow-prod-down11.8%

        \[\leadsto \color{blue}{{\left(\frac{\left(2 \cdot \pi\right) \cdot n}{k} \cdot \frac{\left(2 \cdot \pi\right) \cdot n}{k}\right)}^{0.25}} \]
      7. pow211.8%

        \[\leadsto {\color{blue}{\left({\left(\frac{\left(2 \cdot \pi\right) \cdot n}{k}\right)}^{2}\right)}}^{0.25} \]
      8. associate-/l*11.8%

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

        \[\leadsto {\left({\color{blue}{\left(2 \cdot \frac{\pi}{\frac{k}{n}}\right)}}^{2}\right)}^{0.25} \]
      10. associate-/r/11.8%

        \[\leadsto {\left({\left(2 \cdot \color{blue}{\left(\frac{\pi}{k} \cdot n\right)}\right)}^{2}\right)}^{0.25} \]
    13. Applied egg-rr11.8%

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

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

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

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

        \[\leadsto {\left({\left(n \cdot \color{blue}{\left(\frac{2}{k} \cdot \pi\right)}\right)}^{2}\right)}^{0.25} \]
      5. *-commutative11.8%

        \[\leadsto {\left({\left(n \cdot \color{blue}{\left(\pi \cdot \frac{2}{k}\right)}\right)}^{2}\right)}^{0.25} \]
    15. Simplified11.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 1.3 \cdot 10^{+181}:\\ \;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(n \cdot \left(\pi \cdot \frac{2}{k}\right)\right)}^{2}\right)}^{0.25}\\ \end{array} \]

Alternative 4: 48.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def85.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 37.7% accurate, 1.5× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{\color{blue}{0.5} \cdot \frac{k}{\pi \cdot n}}} \]
  13. Applied egg-rr34.9%

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

      \[\leadsto \frac{1}{\sqrt{0.5 \cdot \color{blue}{\frac{\frac{k}{\pi}}{n}}}} \]
  15. Simplified34.9%

    \[\leadsto \color{blue}{\frac{1}{\sqrt{0.5 \cdot \frac{\frac{k}{\pi}}{n}}}} \]
  16. Final simplification34.9%

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

Alternative 6: 37.2% 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. *-commutative99.6%

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def85.6%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\frac{\pi}{k} \cdot n\right)}} \]
  14. Final simplification34.4%

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

Reproduce

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