Migdal et al, Equation (51)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 0.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.3% accurate, 1.0× speedup?

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

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

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


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

    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. 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. sqr-pow98.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{2} \cdot \color{blue}{\sqrt{n \cdot \pi}}}{\sqrt{k}} \]
    8. Simplified98.7%

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

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

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

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

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

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

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

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

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

    if 6.20000000000000009e-14 < 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. 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-u99.6%

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

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

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

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

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

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

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

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

Alternative 6: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 50.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 50.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 38.3% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 38.3% accurate, 1.5× speedup?

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

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

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

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

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

      \[\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-rr76.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-def86.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-log1p87.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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