Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 99.5%
Time: 17.9s
Alternatives: 10
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 99.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\sqrt{t\_0} \cdot \left({t\_0}^{\left(k \cdot -0.5\right)} \cdot {k}^{-0.5}\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. associate-*r*99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{n \cdot \left(2 \cdot \pi\right)} \cdot \left({\color{blue}{\left(n \cdot \left(2 \cdot \pi\right)\right)}}^{\left(-k \cdot 0.5\right)} \cdot {k}^{-0.5}\right) \]
    11. distribute-rgt-neg-in99.7%

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

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

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

Alternative 2: 99.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \left(n \cdot 2\right)\\
\frac{{t\_0}^{\left(k \cdot -0.5\right)} \cdot \sqrt{t\_0}}{\sqrt{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. Step-by-step derivation
    1. associate-*l/99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}}{\sqrt{k}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-undefine99.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \left(2 \cdot \pi\right)\\ \mathbf{if}\;k \leq 2.75 \cdot 10^{-44}:\\ \;\;\;\;\sqrt{t\_0} \cdot \sqrt{\frac{1}{k}}\\ \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 2.75e-44)
     (* (sqrt t_0) (sqrt (/ 1.0 k)))
     (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 <= 2.75e-44) {
		tmp = sqrt(t_0) * sqrt((1.0 / k));
	} 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 <= 2.75e-44) {
		tmp = Math.sqrt(t_0) * Math.sqrt((1.0 / k));
	} 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 <= 2.75e-44:
		tmp = math.sqrt(t_0) * math.sqrt((1.0 / k))
	else:
		tmp = math.sqrt((math.pow(t_0, (1.0 - k)) / k))
	return tmp
function code(k, n)
	t_0 = Float64(n * Float64(2.0 * pi))
	tmp = 0.0
	if (k <= 2.75e-44)
		tmp = Float64(sqrt(t_0) * sqrt(Float64(1.0 / k)));
	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 <= 2.75e-44)
		tmp = sqrt(t_0) * sqrt((1.0 / k));
	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 * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2.75e-44], N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Sqrt[N[(1.0 / k), $MachinePrecision]], $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 := n \cdot \left(2 \cdot \pi\right)\\
\mathbf{if}\;k \leq 2.75 \cdot 10^{-44}:\\
\;\;\;\;\sqrt{t\_0} \cdot \sqrt{\frac{1}{k}}\\

\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 < 2.74999999999999996e-44

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{n \cdot \left(2 \cdot \pi\right)} \cdot \left({\color{blue}{\left(n \cdot \left(2 \cdot \pi\right)\right)}}^{\left(-k \cdot 0.5\right)} \cdot {k}^{-0.5}\right) \]
      11. distribute-rgt-neg-in99.5%

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

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

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

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

    if 2.74999999999999996e-44 < k

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}}{\sqrt{k}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-sqr-sqrt99.6%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{{\color{blue}{\left(\pi \cdot \left(2 \cdot n\right)\right)}}^{\left(2 \cdot \mathsf{fma}\left(k, -0.5, 0.5\right)\right)}}{\sqrt{k} \cdot \sqrt{k}}} \]
      8. add-sqr-sqrt99.7%

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

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

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

Alternative 4: 52.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := 2 \cdot \frac{\pi}{k}\\
\mathbf{if}\;k \leq 8 \cdot 10^{+152}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{t\_0}\\

\mathbf{else}:\\
\;\;\;\;{\left({\left(n \cdot t\_0\right)}^{3}\right)}^{0.16666666666666666}\\


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

    1. Initial program 99.4%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified51.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
    12. Step-by-step derivation
      1. pow1/252.2%

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

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

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

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

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

        \[\leadsto \sqrt{n} \cdot \color{blue}{\sqrt{2 \cdot \frac{\pi}{k}}} \]
    15. Simplified65.6%

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

    if 8.0000000000000004e152 < k

    1. Initial program 100.0%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified2.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
    12. Step-by-step derivation
      1. pow1/22.9%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 49.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.9 \cdot 10^{+228}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\

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


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

    1. Initial program 99.4%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified46.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
    12. Step-by-step derivation
      1. pow1/246.6%

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

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

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

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

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

        \[\leadsto \sqrt{n} \cdot \color{blue}{\sqrt{2 \cdot \frac{\pi}{k}}} \]
    15. Simplified58.6%

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

    if 4.9000000000000002e228 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left({\left(\color{blue}{\left(\frac{n}{k} \cdot \pi\right)} \cdot 2\right)}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333} \]
      8. associate-*l*17.3%

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

        \[\leadsto {\left({\left(\frac{n}{k} \cdot \left(\pi \cdot 2\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} \]
    9. Applied egg-rr17.3%

      \[\leadsto \color{blue}{{\left({\left(\frac{n}{k} \cdot \left(\pi \cdot 2\right)\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    10. Step-by-step derivation
      1. unpow1/317.3%

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{{\left(\color{blue}{\left(n \cdot 2\right)} \cdot \frac{\pi}{k}\right)}^{1.5}} \]
    11. Simplified17.3%

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

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

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

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

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

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

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

Alternative 6: 49.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.8 \cdot 10^{+216}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\

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


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

    1. Initial program 99.4%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified47.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
    12. Step-by-step derivation
      1. pow1/247.2%

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

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

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

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

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

        \[\leadsto \sqrt{n} \cdot \color{blue}{\sqrt{2 \cdot \frac{\pi}{k}}} \]
    15. Simplified59.4%

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

    if 1.8000000000000001e216 < k

    1. Initial program 100.0%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{n}{k}}} \cdot \sqrt{2} \]
    5. Simplified2.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left({\left(\color{blue}{\left(\frac{n}{k} \cdot \pi\right)} \cdot 2\right)}^{\left(1 + 0.5\right)}\right)}^{0.3333333333333333} \]
      8. associate-*l*16.1%

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

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

      \[\leadsto \color{blue}{{\left({\left(\frac{n}{k} \cdot \left(\pi \cdot 2\right)\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    10. Step-by-step derivation
      1. unpow1/316.1%

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

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

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

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

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

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

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

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

Alternative 7: 99.5% accurate, 1.0× speedup?

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

\\
{k}^{-0.5} \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(0.5 - k \cdot 0.5\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. *-commutative99.5%

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

      \[\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-*l*99.5%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 99.5% accurate, 1.0× speedup?

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

\\
\frac{{\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}}{\sqrt{k}}
\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. associate-*l/99.5%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 47.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}} \]
  12. Step-by-step derivation
    1. pow1/241.0%

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

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

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

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

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

      \[\leadsto \sqrt{n} \cdot \color{blue}{\sqrt{2 \cdot \frac{\pi}{k}}} \]
  15. Simplified51.4%

    \[\leadsto \color{blue}{\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}} \]
  16. Add Preprocessing

Alternative 10: 36.8% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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