Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.4%
Time: 9.9s
Alternatives: 9
Speedup: N/A×

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 9 alternatives:

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

Initial Program: 99.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.4% accurate, N/A× speedup?

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

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

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}} \]
    2. lift-/.f64N/A

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

      \[\leadsto \frac{1}{\color{blue}{\sqrt{k}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    4. lift-pow.f64N/A

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

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(\frac{1 - k}{2}\right)} \]
    6. lift-PI.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\color{blue}{\left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    8. lift--.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\color{blue}{1 - k}}{2}\right)} \]
    9. lift-/.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\color{blue}{\left(\frac{1 - k}{2}\right)}} \]
    10. associate-*l/N/A

      \[\leadsto \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
    11. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{1 \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}} \]
  4. Applied rewrites99.6%

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

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

Alternative 2: 99.4% accurate, N/A× speedup?

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

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

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{1}{k}\right)}^{\frac{1}{2}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    6. lower-pow.f64N/A

      \[\leadsto \color{blue}{{\left(\frac{1}{k}\right)}^{\frac{1}{2}}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    7. inv-powN/A

      \[\leadsto {\color{blue}{\left({k}^{-1}\right)}}^{\frac{1}{2}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    8. lower-pow.f6499.6

      \[\leadsto {\color{blue}{\left({k}^{-1}\right)}}^{0.5} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    9. lift-PI.f64N/A

      \[\leadsto {\left({k}^{-1}\right)}^{\frac{1}{2}} \cdot {\left(\left(2 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    10. lift-*.f64N/A

      \[\leadsto {\left({k}^{-1}\right)}^{\frac{1}{2}} \cdot {\left(\color{blue}{\left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    11. *-commutativeN/A

      \[\leadsto {\left({k}^{-1}\right)}^{\frac{1}{2}} \cdot {\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    12. lower-*.f64N/A

      \[\leadsto {\left({k}^{-1}\right)}^{\frac{1}{2}} \cdot {\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    13. lift-PI.f6499.6

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

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

Alternative 3: 99.4% accurate, N/A× 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}
Derivation
  1. Initial program 99.5%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 4: 99.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\left(\pi \cdot 2\right) \cdot n\right)\\ t_1 := t\_0 \cdot t\_0\\ t_2 := {\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)}\\ t_3 := {\left(\pi \cdot n\right)}^{0.5}\\ \mathbf{if}\;k \leq 4 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sqrt{k}} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(k \cdot \left(t\_1 \cdot t\_0\right)\right) \cdot {2}^{0.5}\right) \cdot t\_3, -0.020833333333333332, \left(0.125 \cdot t\_3\right) \cdot \left(t\_1 \cdot {2}^{0.5}\right)\right), k, \left(-0.5 \cdot t\_3\right) \cdot \left(t\_0 \cdot {2}^{0.5}\right)\right), k, t\_3 \cdot {2}^{0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t\_2 \cdot t\_2\right) \cdot {\left({k}^{-1}\right)}^{0.5}\\ \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (let* ((t_0 (log (* (* PI 2.0) n)))
        (t_1 (* t_0 t_0))
        (t_2
         (pow (exp 0.5) (/ (* (fma -1.0 k 1.0) (log (* n (* PI 2.0)))) 2.0)))
        (t_3 (pow (* PI n) 0.5)))
   (if (<= k 4e-6)
     (*
      (/ 1.0 (sqrt k))
      (fma
       (fma
        (fma
         (* (* (* k (* t_1 t_0)) (pow 2.0 0.5)) t_3)
         -0.020833333333333332
         (* (* 0.125 t_3) (* t_1 (pow 2.0 0.5))))
        k
        (* (* -0.5 t_3) (* t_0 (pow 2.0 0.5))))
       k
       (* t_3 (pow 2.0 0.5))))
     (* (* t_2 t_2) (pow (pow k -1.0) 0.5)))))
double code(double k, double n) {
	double t_0 = log(((((double) M_PI) * 2.0) * n));
	double t_1 = t_0 * t_0;
	double t_2 = pow(exp(0.5), ((fma(-1.0, k, 1.0) * log((n * (((double) M_PI) * 2.0)))) / 2.0));
	double t_3 = pow((((double) M_PI) * n), 0.5);
	double tmp;
	if (k <= 4e-6) {
		tmp = (1.0 / sqrt(k)) * fma(fma(fma((((k * (t_1 * t_0)) * pow(2.0, 0.5)) * t_3), -0.020833333333333332, ((0.125 * t_3) * (t_1 * pow(2.0, 0.5)))), k, ((-0.5 * t_3) * (t_0 * pow(2.0, 0.5)))), k, (t_3 * pow(2.0, 0.5)));
	} else {
		tmp = (t_2 * t_2) * pow(pow(k, -1.0), 0.5);
	}
	return tmp;
}
function code(k, n)
	t_0 = log(Float64(Float64(pi * 2.0) * n))
	t_1 = Float64(t_0 * t_0)
	t_2 = exp(0.5) ^ Float64(Float64(fma(-1.0, k, 1.0) * log(Float64(n * Float64(pi * 2.0)))) / 2.0)
	t_3 = Float64(pi * n) ^ 0.5
	tmp = 0.0
	if (k <= 4e-6)
		tmp = Float64(Float64(1.0 / sqrt(k)) * fma(fma(fma(Float64(Float64(Float64(k * Float64(t_1 * t_0)) * (2.0 ^ 0.5)) * t_3), -0.020833333333333332, Float64(Float64(0.125 * t_3) * Float64(t_1 * (2.0 ^ 0.5)))), k, Float64(Float64(-0.5 * t_3) * Float64(t_0 * (2.0 ^ 0.5)))), k, Float64(t_3 * (2.0 ^ 0.5))));
	else
		tmp = Float64(Float64(t_2 * t_2) * ((k ^ -1.0) ^ 0.5));
	end
	return tmp
end
code[k_, n_] := Block[{t$95$0 = N[Log[N[(N[(Pi * 2.0), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Exp[0.5], $MachinePrecision], N[(N[(N[(-1.0 * k + 1.0), $MachinePrecision] * N[Log[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(Pi * n), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[k, 4e-6], N[(N[(1.0 / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(k * N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * -0.020833333333333332 + N[(N[(0.125 * t$95$3), $MachinePrecision] * N[(t$95$1 * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k + N[(N[(-0.5 * t$95$3), $MachinePrecision] * N[(t$95$0 * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k + N[(t$95$3 * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 * t$95$2), $MachinePrecision] * N[Power[N[Power[k, -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\left(\pi \cdot 2\right) \cdot n\right)\\
t_1 := t\_0 \cdot t\_0\\
t_2 := {\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)}\\
t_3 := {\left(\pi \cdot n\right)}^{0.5}\\
\mathbf{if}\;k \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt{k}} \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(k \cdot \left(t\_1 \cdot t\_0\right)\right) \cdot {2}^{0.5}\right) \cdot t\_3, -0.020833333333333332, \left(0.125 \cdot t\_3\right) \cdot \left(t\_1 \cdot {2}^{0.5}\right)\right), k, \left(-0.5 \cdot t\_3\right) \cdot \left(t\_0 \cdot {2}^{0.5}\right)\right), k, t\_3 \cdot {2}^{0.5}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t\_2 \cdot t\_2\right) \cdot {\left({k}^{-1}\right)}^{0.5}\\


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

    1. Initial program 99.2%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around 0

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \color{blue}{\left(k \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{n \cdot \mathsf{PI}\left(\right)} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{2}\right)\right) + k \cdot \left(\frac{-1}{48} \cdot \left(\left(k \cdot \left({\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right)}^{3} \cdot \sqrt{2}\right)\right) \cdot \sqrt{n \cdot \mathsf{PI}\left(\right)}\right) + \frac{1}{8} \cdot \left(\sqrt{n \cdot \mathsf{PI}\left(\right)} \cdot \left({\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot \sqrt{2}\right)\right)\right)\right) + \sqrt{n \cdot \mathsf{PI}\left(\right)} \cdot \sqrt{2}\right)} \]
    4. Applied rewrites99.0%

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

    if 3.99999999999999982e-6 < k

    1. Initial program 99.8%

      \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in k around -inf

      \[\leadsto \color{blue}{\sqrt{\frac{1}{k}} \cdot e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)} \cdot \color{blue}{\sqrt{\frac{1}{k}}} \]
      2. lower-*.f64N/A

        \[\leadsto e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)} \cdot \color{blue}{\sqrt{\frac{1}{k}}} \]
    5. Applied rewrites99.1%

      \[\leadsto \color{blue}{{\left(e^{0.5}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{0.5}} \]
    6. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\color{blue}{\left({k}^{-1}\right)}}^{\frac{1}{2}} \]
      2. lift-*.f64N/A

        \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{\color{blue}{-1}}\right)}^{\frac{1}{2}} \]
      3. lift-fma.f64N/A

        \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
      4. lift-log.f64N/A

        \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
      5. lift-*.f64N/A

        \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
      6. lift-PI.f64N/A

        \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
      7. lift-*.f64N/A

        \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
      8. sqr-powN/A

        \[\leadsto \left({\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)}\right) \cdot {\color{blue}{\left({k}^{-1}\right)}}^{\frac{1}{2}} \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)}\right) \cdot {\color{blue}{\left({k}^{-1}\right)}}^{\frac{1}{2}} \]
    7. Applied rewrites99.1%

      \[\leadsto \left({\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)} \cdot {\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)}\right) \cdot {\color{blue}{\left({k}^{-1}\right)}}^{0.5} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 99.2% accurate, N/A× speedup?

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

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

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-pow.f64N/A

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

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(\frac{1 - k}{2}\right)} \]
    3. lift-PI.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\color{blue}{\left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    5. lift--.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\color{blue}{1 - k}}{2}\right)} \]
    6. lift-/.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\color{blue}{\left(\frac{1 - k}{2}\right)}} \]
    7. sqr-powN/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \color{blue}{\left({\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \color{blue}{\left({\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right)} \]
    9. lower-pow.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left(\color{blue}{{\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    10. lower-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\color{blue}{\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    11. *-commutativeN/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)} \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    12. lower-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)} \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    13. lift-PI.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\left(\color{blue}{\pi} \cdot 2\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    14. lower-/.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\left(\pi \cdot 2\right) \cdot n\right)}^{\color{blue}{\left(\frac{\frac{1 - k}{2}}{2}\right)}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    15. lift-/.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\left(\pi \cdot 2\right) \cdot n\right)}^{\left(\frac{\color{blue}{\frac{1 - k}{2}}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    16. lift--.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\left(\pi \cdot 2\right) \cdot n\right)}^{\left(\frac{\frac{\color{blue}{1 - k}}{2}}{2}\right)} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\frac{1 - k}{2}}{2}\right)}\right) \]
    17. lower-pow.f64N/A

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

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

Alternative 6: 98.3% accurate, N/A× speedup?

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

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

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-pow.f64N/A

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

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\color{blue}{\left(\left(2 \cdot \pi\right) \cdot n\right)}}^{\left(\frac{1 - k}{2}\right)} \]
    3. lift-PI.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \color{blue}{\mathsf{PI}\left(\right)}\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\color{blue}{\left(2 \cdot \mathsf{PI}\left(\right)\right)} \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
    5. lift--.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{\color{blue}{1 - k}}{2}\right)} \]
    6. lift-/.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\color{blue}{\left(\frac{1 - k}{2}\right)}} \]
    7. unpow-prod-downN/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \color{blue}{\left({\left(2 \cdot \mathsf{PI}\left(\right)\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \color{blue}{\left({\left(2 \cdot \mathsf{PI}\left(\right)\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right)} \]
    9. lower-pow.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left(\color{blue}{{\left(2 \cdot \mathsf{PI}\left(\right)\right)}^{\left(\frac{1 - k}{2}\right)}} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    10. *-commutativeN/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    11. lower-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\color{blue}{\left(\mathsf{PI}\left(\right) \cdot 2\right)}}^{\left(\frac{1 - k}{2}\right)} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    12. lift-PI.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\color{blue}{\pi} \cdot 2\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    13. lift-/.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\pi \cdot 2\right)}^{\color{blue}{\left(\frac{1 - k}{2}\right)}} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    14. lift--.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\pi \cdot 2\right)}^{\left(\frac{\color{blue}{1 - k}}{2}\right)} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    15. lower-pow.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left({\left(\pi \cdot 2\right)}^{\left(\frac{1 - k}{2}\right)} \cdot \color{blue}{{n}^{\left(\frac{1 - k}{2}\right)}}\right) \]
    16. lift-/.f64N/A

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

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

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

    \[\leadsto \frac{1}{\sqrt{k}} \cdot \left(\color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{2}\right)} \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
  6. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left(\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \color{blue}{\sqrt{2}}\right) \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    2. pow1/2N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}} \cdot \sqrt{\color{blue}{2}}\right) \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    3. lower-pow.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left(\left({\mathsf{PI}\left(\right)}^{\frac{1}{2}} \cdot \sqrt{\color{blue}{2}}\right) \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    4. lift-PI.f64N/A

      \[\leadsto \frac{1}{\sqrt{k}} \cdot \left(\left({\pi}^{\frac{1}{2}} \cdot \sqrt{2}\right) \cdot {n}^{\left(\frac{1 - k}{2}\right)}\right) \]
    5. pow1/2N/A

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

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

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

Alternative 7: 95.8% accurate, N/A× speedup?

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

\\
{\left(e^{0.5}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{0.5}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around -inf

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}} \cdot e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)} \cdot \color{blue}{\sqrt{\frac{1}{k}}} \]
    2. lower-*.f64N/A

      \[\leadsto e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)} \cdot \color{blue}{\sqrt{\frac{1}{k}}} \]
  5. Applied rewrites96.0%

    \[\leadsto \color{blue}{{\left(e^{0.5}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{0.5}} \]
  6. Add Preprocessing

Alternative 8: 95.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)}\\ \left(t\_0 \cdot t\_0\right) \cdot {\left({k}^{-1}\right)}^{0.5} \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (let* ((t_0
         (pow (exp 0.5) (/ (* (fma -1.0 k 1.0) (log (* n (* PI 2.0)))) 2.0))))
   (* (* t_0 t_0) (pow (pow k -1.0) 0.5))))
double code(double k, double n) {
	double t_0 = pow(exp(0.5), ((fma(-1.0, k, 1.0) * log((n * (((double) M_PI) * 2.0)))) / 2.0));
	return (t_0 * t_0) * pow(pow(k, -1.0), 0.5);
}
function code(k, n)
	t_0 = exp(0.5) ^ Float64(Float64(fma(-1.0, k, 1.0) * log(Float64(n * Float64(pi * 2.0)))) / 2.0)
	return Float64(Float64(t_0 * t_0) * ((k ^ -1.0) ^ 0.5))
end
code[k_, n_] := Block[{t$95$0 = N[Power[N[Exp[0.5], $MachinePrecision], N[(N[(N[(-1.0 * k + 1.0), $MachinePrecision] * N[Log[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[Power[N[Power[k, -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)}\\
\left(t\_0 \cdot t\_0\right) \cdot {\left({k}^{-1}\right)}^{0.5}
\end{array}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around -inf

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}} \cdot e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)} \cdot \color{blue}{\sqrt{\frac{1}{k}}} \]
    2. lower-*.f64N/A

      \[\leadsto e^{\frac{1}{2} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(1 + -1 \cdot k\right)\right)} \cdot \color{blue}{\sqrt{\frac{1}{k}}} \]
  5. Applied rewrites96.0%

    \[\leadsto \color{blue}{{\left(e^{0.5}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{0.5}} \]
  6. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\color{blue}{\left({k}^{-1}\right)}}^{\frac{1}{2}} \]
    2. lift-*.f64N/A

      \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{\color{blue}{-1}}\right)}^{\frac{1}{2}} \]
    3. lift-fma.f64N/A

      \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
    4. lift-log.f64N/A

      \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
    5. lift-*.f64N/A

      \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
    6. lift-PI.f64N/A

      \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
    7. lift-*.f64N/A

      \[\leadsto {\left(e^{\frac{1}{2}}\right)}^{\left(\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)\right)} \cdot {\left({k}^{-1}\right)}^{\frac{1}{2}} \]
    8. sqr-powN/A

      \[\leadsto \left({\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)}\right) \cdot {\color{blue}{\left({k}^{-1}\right)}}^{\frac{1}{2}} \]
    9. lower-*.f64N/A

      \[\leadsto \left({\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)} \cdot {\left(e^{\frac{1}{2}}\right)}^{\left(\frac{\left(-1 \cdot k + 1\right) \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\right)}{2}\right)}\right) \cdot {\color{blue}{\left({k}^{-1}\right)}}^{\frac{1}{2}} \]
  7. Applied rewrites96.0%

    \[\leadsto \left({\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)} \cdot {\left(e^{0.5}\right)}^{\left(\frac{\mathsf{fma}\left(-1, k, 1\right) \cdot \log \left(n \cdot \left(\pi \cdot 2\right)\right)}{2}\right)}\right) \cdot {\color{blue}{\left({k}^{-1}\right)}}^{0.5} \]
  8. Add Preprocessing

Alternative 9: 59.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-1 \cdot \log n, -1, \log 2 + \log \pi\right)\\ t_1 := {\left(\frac{\pi \cdot k}{n}\right)}^{0.5}\\ t_2 := t\_1 \cdot {2}^{0.5}\\ n \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(t\_2 \cdot \left(t\_0 \cdot t\_0\right), 0.125, \left(\left({\left(\frac{{k}^{3} \cdot \pi}{n}\right)}^{0.5} \cdot {2}^{0.5}\right) \cdot {t\_0}^{3}\right) \cdot -0.020833333333333332\right), k, \left(-0.5 \cdot t\_1\right) \cdot \left(t\_0 \cdot {2}^{0.5}\right)\right), k, t\_2\right)}{k} \end{array} \end{array} \]
(FPCore (k n)
 :precision binary64
 (let* ((t_0 (fma (* -1.0 (log n)) -1.0 (+ (log 2.0) (log PI))))
        (t_1 (pow (/ (* PI k) n) 0.5))
        (t_2 (* t_1 (pow 2.0 0.5))))
   (*
    n
    (/
     (fma
      (fma
       (fma
        (* t_2 (* t_0 t_0))
        0.125
        (*
         (* (* (pow (/ (* (pow k 3.0) PI) n) 0.5) (pow 2.0 0.5)) (pow t_0 3.0))
         -0.020833333333333332))
       k
       (* (* -0.5 t_1) (* t_0 (pow 2.0 0.5))))
      k
      t_2)
     k))))
double code(double k, double n) {
	double t_0 = fma((-1.0 * log(n)), -1.0, (log(2.0) + log(((double) M_PI))));
	double t_1 = pow(((((double) M_PI) * k) / n), 0.5);
	double t_2 = t_1 * pow(2.0, 0.5);
	return n * (fma(fma(fma((t_2 * (t_0 * t_0)), 0.125, (((pow(((pow(k, 3.0) * ((double) M_PI)) / n), 0.5) * pow(2.0, 0.5)) * pow(t_0, 3.0)) * -0.020833333333333332)), k, ((-0.5 * t_1) * (t_0 * pow(2.0, 0.5)))), k, t_2) / k);
}
function code(k, n)
	t_0 = fma(Float64(-1.0 * log(n)), -1.0, Float64(log(2.0) + log(pi)))
	t_1 = Float64(Float64(pi * k) / n) ^ 0.5
	t_2 = Float64(t_1 * (2.0 ^ 0.5))
	return Float64(n * Float64(fma(fma(fma(Float64(t_2 * Float64(t_0 * t_0)), 0.125, Float64(Float64(Float64((Float64(Float64((k ^ 3.0) * pi) / n) ^ 0.5) * (2.0 ^ 0.5)) * (t_0 ^ 3.0)) * -0.020833333333333332)), k, Float64(Float64(-0.5 * t_1) * Float64(t_0 * (2.0 ^ 0.5)))), k, t_2) / k))
end
code[k_, n_] := Block[{t$95$0 = N[(N[(-1.0 * N[Log[n], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[Log[2.0], $MachinePrecision] + N[Log[Pi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(Pi * k), $MachinePrecision] / n), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]}, N[(n * N[(N[(N[(N[(N[(t$95$2 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.125 + N[(N[(N[(N[Power[N[(N[(N[Power[k, 3.0], $MachinePrecision] * Pi), $MachinePrecision] / n), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision] * N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision] * k + N[(N[(-0.5 * t$95$1), $MachinePrecision] * N[(t$95$0 * N[Power[2.0, 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k + t$95$2), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-1 \cdot \log n, -1, \log 2 + \log \pi\right)\\
t_1 := {\left(\frac{\pi \cdot k}{n}\right)}^{0.5}\\
t_2 := t\_1 \cdot {2}^{0.5}\\
n \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(t\_2 \cdot \left(t\_0 \cdot t\_0\right), 0.125, \left(\left({\left(\frac{{k}^{3} \cdot \pi}{n}\right)}^{0.5} \cdot {2}^{0.5}\right) \cdot {t\_0}^{3}\right) \cdot -0.020833333333333332\right), k, \left(-0.5 \cdot t\_1\right) \cdot \left(t\_0 \cdot {2}^{0.5}\right)\right), k, t\_2\right)}{k}
\end{array}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in k around 0

    \[\leadsto \color{blue}{\frac{k \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{k \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sqrt{2}\right)\right) + k \cdot \left(\frac{-1}{48} \cdot \left(\sqrt{{k}^{3} \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)} \cdot \left({\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right)}^{3} \cdot \sqrt{2}\right)\right) + \frac{1}{8} \cdot \left(\sqrt{k \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)} \cdot \left({\log \left(2 \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot \sqrt{2}\right)\right)\right)\right) + \sqrt{k \cdot \left(n \cdot \mathsf{PI}\left(\right)\right)} \cdot \sqrt{2}}{k}} \]
  4. Applied rewrites55.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.020833333333333332 \cdot \left(\sqrt{{k}^{3}} \cdot {\left(\pi \cdot n\right)}^{0.5}\right), \left(\left(\log \left(\left(\pi \cdot 2\right) \cdot n\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right) \cdot {2}^{0.5}, \left(0.125 \cdot {\left(\left(\pi \cdot n\right) \cdot k\right)}^{0.5}\right) \cdot \left(\left(\log \left(\left(\pi \cdot 2\right) \cdot n\right) \cdot \log \left(\left(\pi \cdot 2\right) \cdot n\right)\right) \cdot {2}^{0.5}\right)\right), k, \left(-0.5 \cdot {\left(\left(\pi \cdot n\right) \cdot k\right)}^{0.5}\right) \cdot \left(\log \left(\left(\pi \cdot 2\right) \cdot n\right) \cdot {2}^{0.5}\right)\right), k, {\left(\left(\pi \cdot n\right) \cdot k\right)}^{0.5} \cdot {2}^{0.5}\right)}{k}} \]
  5. Taylor expanded in n around inf

    \[\leadsto \frac{n \cdot \left(k \cdot \left(\frac{-1}{2} \cdot \left(\sqrt{\frac{k \cdot \mathsf{PI}\left(\right)}{n}} \cdot \left(\sqrt{2} \cdot \left(\log \left(2 \cdot \mathsf{PI}\left(\right)\right) + -1 \cdot \log \left(\frac{1}{n}\right)\right)\right)\right) + k \cdot \left(\frac{-1}{48} \cdot \left(\sqrt{\frac{{k}^{3} \cdot \mathsf{PI}\left(\right)}{n}} \cdot \left(\sqrt{2} \cdot {\left(\log \left(2 \cdot \mathsf{PI}\left(\right)\right) + -1 \cdot \log \left(\frac{1}{n}\right)\right)}^{3}\right)\right) + \frac{1}{8} \cdot \left(\sqrt{\frac{k \cdot \mathsf{PI}\left(\right)}{n}} \cdot \left(\sqrt{2} \cdot {\left(\log \left(2 \cdot \mathsf{PI}\left(\right)\right) + -1 \cdot \log \left(\frac{1}{n}\right)\right)}^{2}\right)\right)\right)\right) + \sqrt{\frac{k \cdot \mathsf{PI}\left(\right)}{n}} \cdot \sqrt{2}\right)}{\color{blue}{k}} \]
  6. Applied rewrites61.5%

    \[\leadsto n \cdot \color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left({\left(\frac{\pi \cdot k}{n}\right)}^{0.5} \cdot {2}^{0.5}\right) \cdot \left(\mathsf{fma}\left(0 - \log n, -1, \log 2 + \log \pi\right) \cdot \mathsf{fma}\left(0 - \log n, -1, \log 2 + \log \pi\right)\right), 0.125, \left(\left({\left(\frac{{k}^{3} \cdot \pi}{n}\right)}^{0.5} \cdot {2}^{0.5}\right) \cdot {\left(\mathsf{fma}\left(0 - \log n, -1, \log 2 + \log \pi\right)\right)}^{3}\right) \cdot -0.020833333333333332\right), k, \left(-0.5 \cdot {\left(\frac{\pi \cdot k}{n}\right)}^{0.5}\right) \cdot \left(\mathsf{fma}\left(0 - \log n, -1, \log 2 + \log \pi\right) \cdot {2}^{0.5}\right)\right), k, {\left(\frac{\pi \cdot k}{n}\right)}^{0.5} \cdot {2}^{0.5}\right)}{k}} \]
  7. Final simplification61.5%

    \[\leadsto n \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left({\left(\frac{\pi \cdot k}{n}\right)}^{0.5} \cdot {2}^{0.5}\right) \cdot \left(\mathsf{fma}\left(-1 \cdot \log n, -1, \log 2 + \log \pi\right) \cdot \mathsf{fma}\left(-1 \cdot \log n, -1, \log 2 + \log \pi\right)\right), 0.125, \left(\left({\left(\frac{{k}^{3} \cdot \pi}{n}\right)}^{0.5} \cdot {2}^{0.5}\right) \cdot {\left(\mathsf{fma}\left(-1 \cdot \log n, -1, \log 2 + \log \pi\right)\right)}^{3}\right) \cdot -0.020833333333333332\right), k, \left(-0.5 \cdot {\left(\frac{\pi \cdot k}{n}\right)}^{0.5}\right) \cdot \left(\mathsf{fma}\left(-1 \cdot \log n, -1, \log 2 + \log \pi\right) \cdot {2}^{0.5}\right)\right), k, {\left(\frac{\pi \cdot k}{n}\right)}^{0.5} \cdot {2}^{0.5}\right)}{k} \]
  8. Add Preprocessing

Reproduce

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