Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 98.8%
Time: 20.0s
Alternatives: 14
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 14 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: 98.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.6 \cdot 10^{-66}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\

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


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

    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. Taylor expanded in k around 0 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5999999999999998e-66 < 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. Step-by-step derivation
      1. associate-*l/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 + -0.5 \cdot k\right)}}{\sqrt{k}}} \]
    4. Taylor expanded in k around inf 98.8%

      \[\leadsto \frac{\color{blue}{e^{\log \left(2 \cdot \left(n \cdot \pi\right)\right) \cdot \left(0.5 - 0.5 \cdot k\right)}}}{\sqrt{k}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt98.8%

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{{\color{blue}{\left(\pi \cdot \left(n \cdot 2\right)\right)}}^{\left(2 \cdot \left(0.5 + k \cdot -0.5\right)\right)}}{k}} \]
      4. distribute-lft-in99.8%

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

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\frac{\sqrt{t_0}}{\sqrt{k} \cdot {t_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Derivation
  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. *-commutative99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 51.3% accurate, 1.0× speedup?

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

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

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


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

    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. Taylor expanded in k around 0 59.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.49999999999999964e226 < 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. Taylor expanded in k around 0 3.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(2 \cdot \frac{n \cdot \pi}{k}\right)}^{\color{blue}{\left(2 \cdot 0.25\right)}} \]
      8. pow-sqr3.0%

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

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

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

        \[\leadsto {\left(\left(\frac{n \cdot \pi}{k} \cdot 2\right) \cdot \color{blue}{\left(\frac{n \cdot \pi}{k} \cdot 2\right)}\right)}^{0.25} \]
      12. swap-sqr20.3%

        \[\leadsto {\color{blue}{\left(\left(\frac{n \cdot \pi}{k} \cdot \frac{n \cdot \pi}{k}\right) \cdot \left(2 \cdot 2\right)\right)}}^{0.25} \]
      13. pow220.3%

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

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

        \[\leadsto {\left({\color{blue}{\left(\frac{n}{k} \cdot \pi\right)}}^{2} \cdot \left(2 \cdot 2\right)\right)}^{0.25} \]
      16. metadata-eval20.3%

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

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

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

        \[\leadsto {\left(\color{blue}{\left(2 \cdot 2\right)} \cdot {\left(\frac{n}{k} \cdot \pi\right)}^{2}\right)}^{0.25} \]
      3. unpow220.3%

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

        \[\leadsto {\color{blue}{\left(\left(2 \cdot \left(\frac{n}{k} \cdot \pi\right)\right) \cdot \left(2 \cdot \left(\frac{n}{k} \cdot \pi\right)\right)\right)}}^{0.25} \]
      5. unpow120.3%

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

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

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

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

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

        \[\leadsto {\left({\left(\pi \cdot \left(2 \cdot \frac{n}{k}\right)\right)}^{\color{blue}{2}}\right)}^{0.25} \]
    10. Simplified20.3%

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

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

Alternative 6: 54.0% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{\left({\left(\left(2 \cdot n\right) \cdot \frac{\pi}{k}\right)}^{3}\right)}^{0.16666666666666666}\\


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

    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. Taylor expanded in k around 0 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.95000000000000008e147 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left({\left(2 \cdot \color{blue}{\left(n \cdot \frac{\pi}{k}\right)}\right)}^{\left(2 \cdot 1.5\right)}\right)}^{\left(\frac{0.3333333333333333}{2}\right)} \]
      9. metadata-eval26.4%

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

        \[\leadsto {\left({\left(2 \cdot \left(n \cdot \frac{\pi}{k}\right)\right)}^{3}\right)}^{\color{blue}{0.16666666666666666}} \]
    10. Applied egg-rr26.4%

      \[\leadsto \color{blue}{{\left({\left(2 \cdot \left(n \cdot \frac{\pi}{k}\right)\right)}^{3}\right)}^{0.16666666666666666}} \]
    11. Step-by-step derivation
      1. associate-*r*26.4%

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

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

        \[\leadsto {\left({\left(\frac{\pi}{k} \cdot \color{blue}{\left(n \cdot 2\right)}\right)}^{3}\right)}^{0.16666666666666666} \]
    12. Simplified26.4%

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

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

Alternative 7: 50.0% accurate, 1.0× speedup?

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

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

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


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

    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. Taylor expanded in k around 0 59.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.69999999999999982e226 < 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. Taylor expanded in k around 0 3.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right)} \]
      2. add-cbrt-cube48.7%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right) \cdot \log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right)\right) \cdot \log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right)}} \]
      3. add-log-exp48.7%

        \[\leadsto \sqrt[3]{\left(\color{blue}{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}} \cdot \log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right)\right) \cdot \log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right)} \]
      4. add-log-exp48.7%

        \[\leadsto \sqrt[3]{\left(\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)} \cdot \color{blue}{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right) \cdot \log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right)} \]
      5. add-sqr-sqrt48.7%

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

        \[\leadsto \sqrt[3]{\color{blue}{\left(\left(2 \cdot n\right) \cdot \frac{\pi}{k}\right)} \cdot \log \left(e^{\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}}\right)} \]
      7. add-log-exp13.8%

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

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

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

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

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

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

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

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

Alternative 8: 49.1% accurate, 1.0× speedup?

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

\\
\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}
\end{array}
Derivation
  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. Taylor expanded in k around 0 49.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 49.1% accurate, 1.0× speedup?

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

\\
\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}
\end{array}
Derivation
  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. Taylor expanded in k around 0 49.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 38.2% accurate, 1.5× speedup?

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

\\
{\left(0.5 \cdot \frac{k}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Derivation
  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. add-sqr-sqrt99.5%

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

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

    \[\leadsto \color{blue}{{\left(\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\frac{-1 + k}{-4}\right)}}{{k}^{0.25}}\right)}^{2}} \]
  4. Step-by-step derivation
    1. associate-*r*99.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{1}{0.5} \cdot \color{blue}{\frac{\pi}{\frac{k}{n}}}} \]
    5. times-frac37.5%

      \[\leadsto \sqrt{\color{blue}{\frac{1 \cdot \pi}{0.5 \cdot \frac{k}{n}}}} \]
    6. associate-/l*37.5%

      \[\leadsto \sqrt{\color{blue}{\frac{1}{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}} \]
    7. metadata-eval37.5%

      \[\leadsto \sqrt{\frac{\color{blue}{1 \cdot 1}}{\frac{0.5 \cdot \frac{k}{n}}{\pi}}} \]
    8. add-sqr-sqrt37.4%

      \[\leadsto \sqrt{\frac{1 \cdot 1}{\color{blue}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}} \cdot \sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}}} \]
    9. frac-times37.4%

      \[\leadsto \sqrt{\color{blue}{\frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}} \cdot \frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}}} \]
    10. sqrt-unprod37.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}} \cdot \sqrt{\frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}}} \]
    11. add-sqr-sqrt38.0%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}} \]
    12. pow1/238.0%

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

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

      \[\leadsto {\left(\frac{0.5 \cdot \frac{k}{n}}{\color{blue}{1 \cdot \pi}}\right)}^{\left(-0.5\right)} \]
    15. times-frac38.1%

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

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

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

    \[\leadsto \color{blue}{{\left(0.5 \cdot \frac{\frac{k}{n}}{\pi}\right)}^{-0.5}} \]
  11. Step-by-step derivation
    1. associate-/r*38.1%

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

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

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

Alternative 11: 37.5% accurate, 1.5× speedup?

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\frac{-1 + k}{-4}\right)}}{{k}^{0.25}}\right)}^{2}} \]
  4. Step-by-step derivation
    1. associate-*r*99.4%

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

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

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

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

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

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

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

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

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

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

Alternative 12: 37.5% accurate, 1.5× speedup?

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

\\
\sqrt{\left(2 \cdot n\right) \cdot \frac{\pi}{k}}
\end{array}
Derivation
  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. Taylor expanded in k around 0 49.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 37.5% accurate, 1.5× speedup?

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

\\
\sqrt{\frac{\pi}{\frac{k}{2 \cdot n}}}
\end{array}
Derivation
  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. Taylor expanded in k around 0 49.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{\pi}{\frac{k}{2 \cdot n}}}} \]
  7. Final simplification37.5%

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

Alternative 14: 37.5% accurate, 1.5× speedup?

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

\\
\sqrt{\frac{\pi \cdot \left(2 \cdot n\right)}{k}}
\end{array}
Derivation
  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. Taylor expanded in k around 0 49.7%

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

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

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

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

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

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

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

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

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

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

Reproduce

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