Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.5%
Time: 18.3s
Alternatives: 8
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 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.5% accurate, 0.6× speedup?

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

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

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Step-by-step derivation
    1. unpow-prod-down67.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.6 \cdot 10^{-75}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n + n}}}\\

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


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

    1. Initial program 99.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}\right)} - 1} \]
    3. Applied egg-rr45.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-def64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.59999999999999988e-75 < 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. expm1-log1p-u99.4%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{{\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}} \end{array} \]
(FPCore (k n)
 :precision binary64
 (/ (pow (* n (* PI 2.0)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
	return pow((n * (((double) M_PI) * 2.0)), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
	return Math.pow((n * (Math.PI * 2.0)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n):
	return math.pow((n * (math.pi * 2.0)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n)
	return Float64((Float64(n * Float64(pi * 2.0)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k))
end
function tmp = code(k, n)
	tmp = ((n * (pi * 2.0)) ^ (0.5 - (k / 2.0))) / sqrt(k);
end
code[k_, n_] := N[(N[Power[N[(n * N[(Pi * 2.0), $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(\pi \cdot 2\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Derivation
  1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 54.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.55 \cdot 10^{+145}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n + n}}}\\

\mathbf{else}:\\
\;\;\;\;{\left({\left(\pi \cdot \frac{n}{k}\right)}^{3} \cdot 8\right)}^{0.16666666666666666}\\


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.5500000000000002e145 < 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. expm1-log1p-u100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{\color{blue}{\pi \cdot \left(n \cdot 2\right)}}{k}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} \]
      7. pow-pow5.0%

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

        \[\leadsto \color{blue}{{\left({\left(\frac{\pi \cdot \left(n \cdot 2\right)}{k}\right)}^{1.5}\right)}^{\left(\frac{0.3333333333333333}{2}\right)} \cdot {\left({\left(\frac{\pi \cdot \left(n \cdot 2\right)}{k}\right)}^{1.5}\right)}^{\left(\frac{0.3333333333333333}{2}\right)}} \]
      9. pow-prod-down22.2%

        \[\leadsto \color{blue}{{\left({\left(\frac{\pi \cdot \left(n \cdot 2\right)}{k}\right)}^{1.5} \cdot {\left(\frac{\pi \cdot \left(n \cdot 2\right)}{k}\right)}^{1.5}\right)}^{\left(\frac{0.3333333333333333}{2}\right)}} \]
      10. pow-prod-up22.2%

        \[\leadsto {\color{blue}{\left({\left(\frac{\pi \cdot \left(n \cdot 2\right)}{k}\right)}^{\left(1.5 + 1.5\right)}\right)}}^{\left(\frac{0.3333333333333333}{2}\right)} \]
      11. *-commutative22.2%

        \[\leadsto {\left({\left(\frac{\color{blue}{\left(n \cdot 2\right) \cdot \pi}}{k}\right)}^{\left(1.5 + 1.5\right)}\right)}^{\left(\frac{0.3333333333333333}{2}\right)} \]
      12. *-commutative22.2%

        \[\leadsto {\left({\left(\frac{\color{blue}{\left(2 \cdot n\right)} \cdot \pi}{k}\right)}^{\left(1.5 + 1.5\right)}\right)}^{\left(\frac{0.3333333333333333}{2}\right)} \]
      13. associate-*r*22.2%

        \[\leadsto {\left({\left(\frac{\color{blue}{2 \cdot \left(n \cdot \pi\right)}}{k}\right)}^{\left(1.5 + 1.5\right)}\right)}^{\left(\frac{0.3333333333333333}{2}\right)} \]
      14. associate-*r/22.2%

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

        \[\leadsto {\left({\left(2 \cdot \color{blue}{\frac{n}{\frac{k}{\pi}}}\right)}^{\left(1.5 + 1.5\right)}\right)}^{\left(\frac{0.3333333333333333}{2}\right)} \]
      16. metadata-eval22.2%

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

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

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

        \[\leadsto {\left({\color{blue}{\left(\frac{n}{\frac{k}{\pi}} \cdot 2\right)}}^{3}\right)}^{0.16666666666666666} \]
      2. cube-prod22.2%

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

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

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

        \[\leadsto {\left({\left(\pi \cdot \frac{n}{k}\right)}^{3} \cdot \color{blue}{8}\right)}^{0.16666666666666666} \]
    12. Simplified22.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 3.55 \cdot 10^{+145}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n + n}}}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(\pi \cdot \frac{n}{k}\right)}^{3} \cdot 8\right)}^{0.16666666666666666}\\ \end{array} \]

Alternative 5: 49.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 49.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 38.3% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 38.3% 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.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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