Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.4%
Time: 22.3s
Alternatives: 12
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 12 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 := 2 \cdot \left(n \cdot \pi\right)\\ \frac{\sqrt{t_0}}{{t_0}^{\left(0.5 \cdot k\right)}} \cdot {k}^{-0.5} \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (let* ((t_0 (* 2.0 (* n PI))))
   (* (/ (sqrt t_0) (pow t_0 (* 0.5 k))) (pow k -0.5))))
double code(double k, double n) {
	double t_0 = 2.0 * (n * ((double) M_PI));
	return (sqrt(t_0) / pow(t_0, (0.5 * k))) * pow(k, -0.5);
}
public static double code(double k, double n) {
	double t_0 = 2.0 * (n * Math.PI);
	return (Math.sqrt(t_0) / Math.pow(t_0, (0.5 * k))) * Math.pow(k, -0.5);
}
def code(k, n):
	t_0 = 2.0 * (n * math.pi)
	return (math.sqrt(t_0) / math.pow(t_0, (0.5 * k))) * math.pow(k, -0.5)
function code(k, n)
	t_0 = Float64(2.0 * Float64(n * pi))
	return Float64(Float64(sqrt(t_0) / (t_0 ^ Float64(0.5 * k))) * (k ^ -0.5))
end
function tmp = code(k, n)
	t_0 = 2.0 * (n * pi);
	tmp = (sqrt(t_0) / (t_0 ^ (0.5 * k))) * (k ^ -0.5);
end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(n * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Power[t$95$0, N[(0.5 * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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

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

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

      \[\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. associate-*r/99.7%

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

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

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

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

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

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

      \[\leadsto \frac{{k}^{-0.5} \cdot \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)}}} \]
    14. metadata-eval99.7%

      \[\leadsto \frac{{k}^{-0.5} \cdot \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.7%

    \[\leadsto \color{blue}{\frac{{k}^{-0.5} \cdot \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.7%

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

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

      \[\leadsto \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)}} \cdot {k}^{-0.5}} \]
    4. *-commutative99.7%

      \[\leadsto \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)}} \cdot {k}^{-0.5} \]
    5. *-commutative99.7%

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

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

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

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

Alternative 2: 99.4% accurate, 0.6× speedup?

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

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

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

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

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

      \[\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. Step-by-step derivation
    1. div-inv99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.4% accurate, 1.0× speedup?

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

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

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


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

    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. div-sub99.2%

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

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

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

        \[\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-unprod71.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 \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}}} \]
      7. frac-times71.4%

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

      \[\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 71.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\log \left(\frac{n}{\frac{k}{2 \cdot \pi}}\right) \cdot 0.5}} \]
    9. Step-by-step derivation
      1. exp-to-pow71.6%

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

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

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

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

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

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

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

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

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

    if 3.00000000000000006e-17 < 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. unpow-prod-down55.3%

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

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

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

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

        \[\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/2100.0%

        \[\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. associate-*r/100.0%

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

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

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

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

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

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

        \[\leadsto \frac{{k}^{-0.5} \cdot \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)}}} \]
      14. metadata-eval100.0%

        \[\leadsto \frac{{k}^{-0.5} \cdot \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-rr100.0%

      \[\leadsto \color{blue}{\frac{{k}^{-0.5} \cdot \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. *-commutative100.0%

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

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

        \[\leadsto \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)}} \cdot {k}^{-0.5}} \]
      4. *-commutative100.0%

        \[\leadsto \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)}} \cdot {k}^{-0.5} \]
      5. *-commutative100.0%

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

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

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

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

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

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

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

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

    Alternative 4: 99.3% accurate, 1.0× speedup?

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

      1. Initial program 99.3%

        \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
      2. 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.3%

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

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

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

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

        \[\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 71.5%

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

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

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

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

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

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

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

          \[\leadsto e^{\log \color{blue}{\left(\frac{n}{\frac{k}{2 \cdot \pi}}\right)} \cdot 0.5} \]
      8. Applied egg-rr66.6%

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

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

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

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

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

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

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

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

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

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

      if 1.3200000000000001e-17 < 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.5%

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

    Alternative 5: 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.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. associate-*l/99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 50.7% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;k \leq 2.5 \cdot 10^{+254}:\\ \;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\ \end{array} \end{array} \]
    (FPCore (k n)
     :precision binary64
     (if (<= k 2.5e+254)
       (* (sqrt n) (sqrt (* 2.0 (/ PI k))))
       (cbrt (pow (* 2.0 (* PI (/ n k))) 1.5))))
    double code(double k, double n) {
    	double tmp;
    	if (k <= 2.5e+254) {
    		tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
    	} else {
    		tmp = cbrt(pow((2.0 * (((double) M_PI) * (n / k))), 1.5));
    	}
    	return tmp;
    }
    
    public static double code(double k, double n) {
    	double tmp;
    	if (k <= 2.5e+254) {
    		tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
    	} else {
    		tmp = Math.cbrt(Math.pow((2.0 * (Math.PI * (n / k))), 1.5));
    	}
    	return tmp;
    }
    
    function code(k, n)
    	tmp = 0.0
    	if (k <= 2.5e+254)
    		tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k))));
    	else
    		tmp = cbrt((Float64(2.0 * Float64(pi * Float64(n / k))) ^ 1.5));
    	end
    	return tmp
    end
    
    code[k_, n_] := If[LessEqual[k, 2.5e+254], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;k \leq 2.5 \cdot 10^{+254}:\\
    \;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if k < 2.49999999999999997e254

      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. div-sub99.4%

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

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

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

          \[\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-unprod85.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-times84.9%

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

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

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

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

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

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

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

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

          \[\leadsto e^{\log \color{blue}{\left(\frac{n}{\frac{k}{2 \cdot \pi}}\right)} \cdot 0.5} \]
      8. Applied egg-rr36.9%

        \[\leadsto \color{blue}{e^{\log \left(\frac{n}{\frac{k}{2 \cdot \pi}}\right) \cdot 0.5}} \]
      9. Step-by-step derivation
        1. exp-to-pow39.4%

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

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

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

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

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

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

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

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

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

      if 2.49999999999999997e254 < 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. div-sub100.0%

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

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

          \[\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-sqrt100.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-unprod100.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-times100.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-rr100.0%

        \[\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 2.9%

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

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

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

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

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

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

          \[\leadsto \color{blue}{{\left(\left(\sqrt{\frac{n \cdot \left(2 \cdot \pi\right)}{k}} \cdot \sqrt{\frac{n \cdot \left(2 \cdot \pi\right)}{k}}\right) \cdot \sqrt{\frac{n \cdot \left(2 \cdot \pi\right)}{k}}\right)}^{0.3333333333333333}} \]
        3. add-sqr-sqrt26.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt[3]{{\left(2 \cdot \color{blue}{\frac{n}{\frac{k}{\pi}}}\right)}^{1.5}} \]
        9. associate-/r/26.8%

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

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

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

    Alternative 7: 49.9% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}} \end{array} \]
    (FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* 2.0 (/ PI k)))))
    double code(double k, double n) {
    	return sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
    }
    
    public static double code(double k, double n) {
    	return Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
    }
    
    def code(k, n):
    	return math.sqrt(n) * math.sqrt((2.0 * (math.pi / k)))
    
    function code(k, n)
    	return Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k))))
    end
    
    function tmp = code(k, n)
    	tmp = sqrt(n) * sqrt((2.0 * (pi / k)));
    end
    
    code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}
    \end{array}
    
    Derivation
    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. div-sub99.5%

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

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

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

        \[\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-unprod86.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 \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}}} \]
      7. frac-times86.3%

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

      \[\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 36.0%

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

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

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

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

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

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

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{n}{\frac{k}{2 \cdot \pi}}\right)} \cdot 0.5} \]
    8. Applied egg-rr33.7%

      \[\leadsto \color{blue}{e^{\log \left(\frac{n}{\frac{k}{2 \cdot \pi}}\right) \cdot 0.5}} \]
    9. Step-by-step derivation
      1. exp-to-pow36.0%

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

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

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

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

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

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

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

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

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

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

    Alternative 8: 38.6% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}} \end{array} \]
    (FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (* 0.5 (/ k n)) PI))))
    double code(double k, double n) {
    	return 1.0 / sqrt(((0.5 * (k / n)) / ((double) M_PI)));
    }
    
    public static double code(double k, double n) {
    	return 1.0 / Math.sqrt(((0.5 * (k / n)) / Math.PI));
    }
    
    def code(k, n):
    	return 1.0 / math.sqrt(((0.5 * (k / n)) / math.pi))
    
    function code(k, n)
    	return Float64(1.0 / sqrt(Float64(Float64(0.5 * Float64(k / n)) / pi)))
    end
    
    function tmp = code(k, n)
    	tmp = 1.0 / sqrt(((0.5 * (k / n)) / pi));
    end
    
    code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(0.5 * N[(k / n), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}
    \end{array}
    
    Derivation
    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. div-sub99.5%

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

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

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

        \[\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-unprod86.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 \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}}} \]
      7. frac-times86.3%

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

      \[\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 36.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{0.5} \cdot \frac{k}{n \cdot \pi}}} \]
    11. Applied egg-rr37.3%

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

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

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

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{\frac{k \cdot 0.5}{\pi}}{n}}}} \]
      4. associate-/l/37.3%

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

        \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{0.5 \cdot k}}{n \cdot \pi}}} \]
      6. associate-*r/37.3%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{0.5 \cdot \frac{k}{n \cdot \pi}}}} \]
      7. associate-/r*37.3%

        \[\leadsto \frac{1}{\sqrt{0.5 \cdot \color{blue}{\frac{\frac{k}{n}}{\pi}}}} \]
      8. associate-*r/37.3%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}} \]
    13. Simplified37.3%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}} \]
    14. Final simplification37.3%

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

    Alternative 9: 38.6% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \frac{1}{\sqrt{\frac{\frac{0.5 \cdot 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(Float64(Float64(0.5 * 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[(N[(N[(0.5 * k), $MachinePrecision] / Pi), $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{1}{\sqrt{\frac{\frac{0.5 \cdot k}{\pi}}{n}}}
    \end{array}
    
    Derivation
    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. div-sub99.5%

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

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

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

        \[\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-unprod86.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 \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}}} \]
      7. frac-times86.3%

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

      \[\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 36.0%

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

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

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

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

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

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

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{n}{\frac{k}{2 \cdot \pi}}\right)} \cdot 0.5} \]
    8. Applied egg-rr33.7%

      \[\leadsto \color{blue}{e^{\log \left(\frac{n}{\frac{k}{2 \cdot \pi}}\right) \cdot 0.5}} \]
    9. Step-by-step derivation
      1. exp-to-pow36.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\frac{\color{blue}{\frac{\frac{k}{2}}{\pi}}}{n}}} \]
      7. div-inv37.3%

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

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

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

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

    Alternative 10: 37.8% 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.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. div-sub99.5%

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

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

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

        \[\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-unprod86.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 \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}}} \]
      7. frac-times86.3%

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

      \[\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 36.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 11: 37.8% 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.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. div-sub99.5%

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

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

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

        \[\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-unprod86.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 \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}}} \]
      7. frac-times86.3%

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

      \[\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 36.0%

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

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

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

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

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

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

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

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

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

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

    Alternative 12: 37.8% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \sqrt{2 \cdot \frac{n}{\frac{k}{\pi}}} \end{array} \]
    (FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ n (/ k PI)))))
    double code(double k, double n) {
    	return sqrt((2.0 * (n / (k / ((double) M_PI)))));
    }
    
    public static double code(double k, double n) {
    	return Math.sqrt((2.0 * (n / (k / Math.PI))));
    }
    
    def code(k, n):
    	return math.sqrt((2.0 * (n / (k / math.pi))))
    
    function code(k, n)
    	return sqrt(Float64(2.0 * Float64(n / Float64(k / pi))))
    end
    
    function tmp = code(k, n)
    	tmp = sqrt((2.0 * (n / (k / pi))));
    end
    
    code[k_, n_] := N[Sqrt[N[(2.0 * N[(n / N[(k / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \sqrt{2 \cdot \frac{n}{\frac{k}{\pi}}}
    \end{array}
    
    Derivation
    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. div-sub99.5%

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

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

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

        \[\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-unprod86.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 \frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}}} \]
      7. frac-times86.3%

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

      \[\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 36.0%

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

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

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

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

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

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

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

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

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

    Reproduce

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