Migdal et al, Equation (51)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.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. *-commutative98.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. *-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot \sqrt{{k}^{\color{blue}{\left(-0.5 + -0.5\right)}}} \]
      9. pow-prod-up98.3%

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

        \[\leadsto \sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot \color{blue}{\left(\sqrt{{k}^{-0.5}} \cdot \sqrt{{k}^{-0.5}}\right)} \]
      11. add-sqr-sqrt98.3%

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

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

    if 1.3499999999999999e-75 < k

    1. Initial program 99.6%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Step-by-step derivation
      1. expm1-log1p-u98.8%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{k}^{-0.5}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    6. 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 {k}^{-0.5}} \]
      2. associate-*l*99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.5% accurate, 1.0× speedup?

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

\\
{k}^{-0.5} \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Derivation
  1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.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. *-commutative98.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. *-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot \sqrt{{k}^{\color{blue}{\left(-0.5 + -0.5\right)}}} \]
      9. pow-prod-up98.3%

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

        \[\leadsto \sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot \color{blue}{\left(\sqrt{{k}^{-0.5}} \cdot \sqrt{{k}^{-0.5}}\right)} \]
      11. add-sqr-sqrt98.3%

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

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

    if 1.3499999999999999e-75 < k

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 6: 49.8% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \frac{\pi}{\frac{k}{n}}\right)}^{1.5}}\\


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

    1. Initial program 99.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. *-commutative99.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. *-commutative99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.0000000000000001e228 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{\pi \cdot n}{k}}} \]
    9. Step-by-step derivation
      1. add-cbrt-cube23.0%

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

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

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

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

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

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

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

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

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

Alternative 7: 49.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 8.2 \cdot 10^{+229}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(n \cdot 2\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \frac{\pi}{\frac{k}{n}}\right)}^{1.5}}\\


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

    1. Initial program 99.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. *-commutative99.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. *-commutative99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\pi \cdot \left(2 \cdot n\right)} \cdot \sqrt{{k}^{\color{blue}{\left(-0.5 + -0.5\right)}}} \]
      9. pow-prod-up53.5%

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

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

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

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

    if 8.2000000000000003e229 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{\pi \cdot n}{k}}} \]
    9. Step-by-step derivation
      1. add-cbrt-cube23.0%

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

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

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

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

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

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

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

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

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

Alternative 8: 48.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def87.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-log1p88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 38.1% accurate, 1.5× speedup?

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

\\
{\left(\frac{k}{n} \cdot \frac{0.5}{\pi}\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 99.1%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def87.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-log1p88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto e^{\mathsf{log1p}\left({\left(\frac{k}{\pi \cdot n} \cdot \color{blue}{0.5}\right)}^{\left(-0.5\right)}\right)} - 1 \]
    7. metadata-eval36.6%

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\frac{k}{n} \cdot \frac{0.5}{\pi}\right)}}^{-0.5} \]
  14. Simplified37.0%

    \[\leadsto \color{blue}{{\left(\frac{k}{n} \cdot \frac{0.5}{\pi}\right)}^{-0.5}} \]
  15. Final simplification37.0%

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

Alternative 10: 38.1% accurate, 1.5× speedup?

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

\\
{\left(0.5 \cdot \frac{k}{n \cdot \pi}\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 99.1%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def87.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-log1p88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 37.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \sqrt{2 \cdot \frac{n \cdot \pi}{k}} \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(Float64(n * 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), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{2 \cdot \frac{n \cdot \pi}{k}}
\end{array}
Derivation
  1. Initial program 99.1%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\right)} - 1} \]
  4. Step-by-step derivation
    1. expm1-def87.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-log1p88.7%

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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