Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.4%
Time: 13.5s
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.4% accurate, 0.6× speedup?

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

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

      \[\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)}} \]
    2. metadata-eval99.3%

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

      \[\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)}}} \]
    4. pow1/299.6%

      \[\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)}} \]
    5. associate-*l*99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 1.0× speedup?

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

\\
{k}^{-0.5} \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Derivation
  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. expm1-log1p-u95.9%

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

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

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

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{{k}^{\left(-0.5\right)}}\right)} - 1\right) \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    5. metadata-eval76.0%

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.2%

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

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

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

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

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

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

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

      \[\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-def62.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-log1p65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.29999999999999998e-100 < k

    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.3%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.4% accurate, 1.0× speedup?

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

\\
\frac{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Derivation
  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. associate-*l/99.4%

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

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

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

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

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

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

Alternative 5: 50.1% accurate, 1.0× speedup?

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

\\
{k}^{-0.5} \cdot \sqrt{n \cdot \left(2 \cdot \pi\right)}
\end{array}
Derivation
  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. expm1-log1p-u95.9%

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

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

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

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{{k}^{\left(-0.5\right)}}\right)} - 1\right) \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    5. metadata-eval76.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 50.1% accurate, 1.0× speedup?

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

\\
\frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{\sqrt{k}}
\end{array}
Derivation
  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. *-commutative99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{\left(2 \cdot \pi\right) \cdot n}}{\sqrt{k}}} \]
  15. Final simplification52.1%

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

Alternative 7: 38.5% accurate, 1.5× 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.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. *-commutative99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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