Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.5%
Time: 14.5s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \left(n \cdot 2\right) \cdot \pi\\
{k}^{-0.5} \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. expm1-log1p-u95.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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)}} \]
  7. Applied egg-rr99.3%

    \[\leadsto {k}^{-0.5} \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)}}} \]
  8. Step-by-step derivation
    1. *-commutative99.3%

      \[\leadsto {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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 {k}^{-0.5} \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)}}} \]
  9. Simplified99.3%

    \[\leadsto {k}^{-0.5} \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)}}} \]
  10. Final simplification99.3%

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

Alternative 2: 99.4% accurate, 0.8× speedup?

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

\\
\frac{\frac{1}{\sqrt{k}}}{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(\mathsf{fma}\left(k, 0.5, -0.5\right)\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. *-commutative99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.5%

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

        \[\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-udef91.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/291.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-flip91.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-eval91.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-rr91.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-def91.3%

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

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

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

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

        \[\leadsto {k}^{-0.5} \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/298.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

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

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

        \[\leadsto {k}^{-0.5} \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)}} \]
    7. Applied egg-rr98.6%

      \[\leadsto {k}^{-0.5} \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)}}} \]
    8. Step-by-step derivation
      1. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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)}}} \]
    9. Simplified98.6%

      \[\leadsto {k}^{-0.5} \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)}}} \]
    10. Taylor expanded in k around 0 98.6%

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

    if 3.0500000000000001e-33 < k

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
      5. expm1-log1p-u99.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-udef95.9%

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

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

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

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

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

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

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

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

Alternative 4: 99.4% accurate, 1.0× speedup?

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

\\
\sqrt{\frac{1}{k}} \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. add-sqr-sqrt99.0%

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

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

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

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

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

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

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

Alternative 5: 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-u95.5%

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

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

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

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

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

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

      \[\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 6: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(n \cdot 2\right) \cdot \pi\\ \mathbf{if}\;k \leq 9 \cdot 10^{-34}:\\ \;\;\;\;{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 (* (* n 2.0) PI)))
   (if (<= k 9e-34)
     (* (pow k -0.5) (sqrt t_0))
     (sqrt (/ (pow t_0 (- 1.0 k)) k)))))
double code(double k, double n) {
	double t_0 = (n * 2.0) * ((double) M_PI);
	double tmp;
	if (k <= 9e-34) {
		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 = (n * 2.0) * Math.PI;
	double tmp;
	if (k <= 9e-34) {
		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 = (n * 2.0) * math.pi
	tmp = 0
	if k <= 9e-34:
		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(Float64(n * 2.0) * pi)
	tmp = 0.0
	if (k <= 9e-34)
		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 = (n * 2.0) * pi;
	tmp = 0.0;
	if (k <= 9e-34)
		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[(N[(n * 2.0), $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[k, 9e-34], 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 := \left(n \cdot 2\right) \cdot \pi\\
\mathbf{if}\;k \leq 9 \cdot 10^{-34}:\\
\;\;\;\;{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 < 9.00000000000000085e-34

    1. Initial program 98.5%

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

        \[\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-udef91.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/291.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-flip91.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-eval91.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-rr91.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-def91.3%

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

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

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

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

        \[\leadsto {k}^{-0.5} \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/298.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

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

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

        \[\leadsto {k}^{-0.5} \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)}} \]
    7. Applied egg-rr98.6%

      \[\leadsto {k}^{-0.5} \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)}}} \]
    8. Step-by-step derivation
      1. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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*98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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. *-commutative98.6%

        \[\leadsto {k}^{-0.5} \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)}}} \]
    9. Simplified98.6%

      \[\leadsto {k}^{-0.5} \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)}}} \]
    10. Taylor expanded in k around 0 98.6%

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

    if 9.00000000000000085e-34 < k

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
      5. expm1-log1p-u99.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-udef95.9%

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

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

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

      \[\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 9 \cdot 10^{-34}:\\ \;\;\;\;{k}^{-0.5} \cdot \sqrt{\left(n \cdot 2\right) \cdot \pi}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(1 - k\right)}}{k}}\\ \end{array} \]

Alternative 7: 99.5% accurate, 1.0× speedup?

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

\\
\frac{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Derivation
  1. Initial program 99.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(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}} \]

Alternative 8: 87.7% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 37.7% accurate, 1.0× speedup?

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

\\
\sqrt{2 \cdot \frac{n}{k}} \cdot \sqrt{\pi}
\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.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 37.8% accurate, 1.0× speedup?

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

\\
\sqrt{\pi \cdot \frac{n}{k}} \cdot \sqrt{2}
\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.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 37.9% accurate, 1.5× speedup?

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

\\
\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}
\end{array}
Derivation
  1. Initial program 99.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.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 37.9% accurate, 1.5× speedup?

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

\\
\sqrt{2 \cdot \frac{\pi}{\frac{k}{n}}}
\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.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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