Migdal et al, Equation (51)

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    8. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    9. div-subN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\frac{1}{2} - \frac{k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    10. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\left(\frac{1}{2}\right), \left(\frac{k}{2}\right)\right)\right), \left(\sqrt{k}\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \left(\frac{k}{2}\right)\right)\right), \left(\sqrt{k}\right)\right) \]
    12. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(k, 2\right)\right)\right), \left(\sqrt{k}\right)\right) \]
    13. sqrt-lowering-sqrt.f6499.1%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(k, 2\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
  3. Simplified99.1%

    \[\leadsto \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. pow-subN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\frac{1}{2}}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{k}{2}\right)}}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    5. pow-subN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} - \frac{k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} - \frac{k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    7. div-subN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    8. rem-exp-logN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(e^{\log \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}\right)}^{\left(\frac{1 - k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    9. pow-flipN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left({\left(e^{\log \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}\right)}^{\left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    10. rem-exp-logN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    11. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    14. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
  6. Applied egg-rr99.1%

    \[\leadsto \frac{\color{blue}{\frac{1}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\frac{k}{2} + -0.5\right)}}}}{\sqrt{k}} \]
  7. Step-by-step derivation
    1. pow-flipN/A

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

      \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\mathsf{neg}\left(\left(\frac{-1}{2} + \frac{k}{2}\right)\right)\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    3. distribute-neg-inN/A

      \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) + \left(\mathsf{neg}\left(\frac{k}{2}\right)\right)\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{k}{2}\right)\right)\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    5. sub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} - \frac{k}{2}\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    6. pow-subN/A

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\sqrt{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{k}{2}\right)}}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    8. sqrt-pow1N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\sqrt{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}}{\sqrt{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}}}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    9. sqrt-undivN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    14. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    15. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), k\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
  8. Applied egg-rr99.3%

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

Alternative 2: 99.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6471.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified71.2%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1}{k} \cdot 2\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{k}\right), 2\right)\right)\right) \]
      12. /-lowering-/.f6498.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, k\right), 2\right)\right)\right) \]
    7. Applied egg-rr98.4%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{k}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{2}{k}\right)\right)\right) \]
      3. /-lowering-/.f6498.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, k\right)\right)\right) \]
    9. Applied egg-rr98.4%

      \[\leadsto \sqrt{\pi \cdot n} \cdot \sqrt{\color{blue}{\frac{2}{k}}} \]
    10. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{2}{k}} \]
      2. clear-numN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{1}{\frac{k}{2}}} \]
      3. div-invN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{\frac{k}{2}}} \]
      4. div-invN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{k \cdot \frac{1}{2}}} \]
      5. metadata-evalN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{k \cdot \frac{1}{2}}} \]
      6. times-fracN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\frac{\mathsf{PI}\left(\right)}{k}\right), \frac{1}{2}\right), \left(\sqrt{\color{blue}{n \cdot 2}}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), k\right), \frac{1}{2}\right), \left(\sqrt{\color{blue}{n} \cdot 2}\right)\right) \]
      14. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \left(\sqrt{n \cdot 2}\right)\right) \]
      15. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(n \cdot 2\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(n \cdot \frac{1}{\frac{1}{2}}\right)\right)\right) \]
      17. div-invN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(\frac{n}{\frac{1}{2}}\right)\right)\right) \]
      18. /-lowering-/.f6498.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(n, \frac{1}{2}\right)\right)\right) \]
    11. Applied egg-rr98.5%

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

    if 3.59999999999999985e-11 < k

    1. Initial program 99.7%

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
      8. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
      9. div-subN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\frac{1}{2} - \frac{k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\left(\frac{1}{2}\right), \left(\frac{k}{2}\right)\right)\right), \left(\sqrt{k}\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \left(\frac{k}{2}\right)\right)\right), \left(\sqrt{k}\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(k, 2\right)\right)\right), \left(\sqrt{k}\right)\right) \]
      13. sqrt-lowering-sqrt.f6499.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(k, 2\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. pow-subN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\frac{1}{2}}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{k}{2}\right)}}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      5. pow-subN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} - \frac{k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} - \frac{k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      7. div-subN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      8. rem-exp-logN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{{\left(e^{\log \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}\right)}^{\left(\frac{1 - k}{2}\right)}}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      9. pow-flipN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left({\left(e^{\log \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}\right)}^{\left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      10. rem-exp-logN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)}\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      11. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      14. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\mathsf{neg}\left(\frac{1 - k}{2}\right)\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    6. Applied egg-rr99.7%

      \[\leadsto \frac{\color{blue}{\frac{1}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\frac{k}{2} + -0.5\right)}}}}{\sqrt{k}} \]
    7. Step-by-step derivation
      1. pow-flipN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\mathsf{neg}\left(\left(\frac{-1}{2} + \frac{k}{2}\right)\right)\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      3. distribute-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) + \left(\mathsf{neg}\left(\frac{k}{2}\right)\right)\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} + \left(\mathsf{neg}\left(\frac{k}{2}\right)\right)\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} - \frac{k}{2}\right)}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      6. pow-subN/A

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\sqrt{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{k}{2}\right)}}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      8. sqrt-pow1N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\sqrt{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}}{\sqrt{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}}}\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      9. sqrt-undivN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      14. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
      15. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), k\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    8. Applied egg-rr100.0%

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

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

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{\frac{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}}}{k}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}}\right), k\right)\right) \]
      4. clear-numN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{\frac{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}}{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}}\right), k\right)\right) \]
      5. associate-/r/N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{k}} \cdot \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), k\right)\right) \]
      6. pow-flipN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\mathsf{neg}\left(k\right)\right)} \cdot \left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), k\right)\right) \]
      7. pow-plusN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left({\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\left(\mathsf{neg}\left(k\right)\right) + 1\right)}\right), k\right)\right) \]
      8. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\left(\mathsf{neg}\left(k\right)\right) + 1\right)\right), k\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\left(\mathsf{neg}\left(k\right)\right) + 1\right)\right), k\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left(\left(\mathsf{neg}\left(k\right)\right) + 1\right)\right), k\right)\right) \]
      11. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\left(\mathsf{neg}\left(k\right)\right) + 1\right)\right), k\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{+.f64}\left(\left(\mathsf{neg}\left(k\right)\right), 1\right)\right), k\right)\right) \]
      13. neg-sub0N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{+.f64}\left(\left(0 - k\right), 1\right)\right), k\right)\right) \]
      14. --lowering--.f6499.7%

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{+.f64}\left(\mathsf{\_.f64}\left(0, k\right), 1\right)\right), k\right)\right) \]
    10. Applied egg-rr99.7%

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

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

Alternative 3: 61.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.1%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6462.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified62.1%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1}{k} \cdot 2\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{k}\right), 2\right)\right)\right) \]
      12. /-lowering-/.f6499.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, k\right), 2\right)\right)\right) \]
    7. Applied egg-rr99.3%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{k}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{2}{k}\right)\right)\right) \]
      3. /-lowering-/.f6499.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, k\right)\right)\right) \]
    9. Applied egg-rr99.3%

      \[\leadsto \sqrt{\pi \cdot n} \cdot \sqrt{\color{blue}{\frac{2}{k}}} \]
    10. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{2}{k}} \]
      2. clear-numN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{1}{\frac{k}{2}}} \]
      3. div-invN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{\frac{k}{2}}} \]
      4. div-invN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{k \cdot \frac{1}{2}}} \]
      5. metadata-evalN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{k \cdot \frac{1}{2}}} \]
      6. times-fracN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\frac{\mathsf{PI}\left(\right)}{k}\right), \frac{1}{2}\right), \left(\sqrt{\color{blue}{n \cdot 2}}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), k\right), \frac{1}{2}\right), \left(\sqrt{\color{blue}{n} \cdot 2}\right)\right) \]
      14. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \left(\sqrt{n \cdot 2}\right)\right) \]
      15. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(n \cdot 2\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(n \cdot \frac{1}{\frac{1}{2}}\right)\right)\right) \]
      17. div-invN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(\frac{n}{\frac{1}{2}}\right)\right)\right) \]
      18. /-lowering-/.f6499.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(n, \frac{1}{2}\right)\right)\right) \]
    11. Applied egg-rr99.5%

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

    if 3.80000000000000003e-134 < k

    1. Initial program 99.5%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6427.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified27.3%

      \[\leadsto \color{blue}{\sqrt{\frac{n \cdot \pi}{k}} \cdot \sqrt{2}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \sqrt{2} \cdot \frac{\sqrt{\mathsf{PI}\left(\right) \cdot n}}{\sqrt{k}} \]
      4. associate-*r/N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}\right), \color{blue}{\left(\sqrt{k}\right)}\right) \]
      7. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), \left(\sqrt{\color{blue}{k}}\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), \left(\sqrt{k}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right), \left(\sqrt{k}\right)\right) \]
      10. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \left(\sqrt{k}\right)\right) \]
      11. sqrt-lowering-sqrt.f6430.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
    7. Applied egg-rr30.6%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \left({k}^{\color{blue}{\frac{1}{2}}}\right)\right) \]
      2. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{*.f64}\left(k, k\right), \left(\color{blue}{\frac{1}{2}} \cdot \frac{1}{2}\right)\right)\right) \]
      8. metadata-eval50.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{pow.f64}\left(\mathsf{*.f64}\left(k, k\right), \frac{1}{4}\right)\right) \]
    9. Applied egg-rr50.1%

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

Alternative 4: 50.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.55 \cdot 10^{+260}:\\
\;\;\;\;{\left(\frac{\pi}{k}\right)}^{0.5} \cdot \sqrt{\frac{n}{0.5}}\\

\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\


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

    1. Initial program 99.0%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6441.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified41.2%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1}{k} \cdot 2\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{k}\right), 2\right)\right)\right) \]
      12. /-lowering-/.f6456.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, k\right), 2\right)\right)\right) \]
    7. Applied egg-rr56.1%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{k}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{2}{k}\right)\right)\right) \]
      3. /-lowering-/.f6456.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, k\right)\right)\right) \]
    9. Applied egg-rr56.1%

      \[\leadsto \sqrt{\pi \cdot n} \cdot \sqrt{\color{blue}{\frac{2}{k}}} \]
    10. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{2}{k}} \]
      2. clear-numN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{1}{\frac{k}{2}}} \]
      3. div-invN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{\frac{k}{2}}} \]
      4. div-invN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{k \cdot \frac{1}{2}}} \]
      5. metadata-evalN/A

        \[\leadsto \sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{k \cdot \frac{1}{2}}} \]
      6. times-fracN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\frac{\mathsf{PI}\left(\right)}{k}\right), \frac{1}{2}\right), \left(\sqrt{\color{blue}{n \cdot 2}}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), k\right), \frac{1}{2}\right), \left(\sqrt{\color{blue}{n} \cdot 2}\right)\right) \]
      14. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \left(\sqrt{n \cdot 2}\right)\right) \]
      15. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(n \cdot 2\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(n \cdot \frac{1}{\frac{1}{2}}\right)\right)\right) \]
      17. div-invN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\left(\frac{n}{\frac{1}{2}}\right)\right)\right) \]
      18. /-lowering-/.f6456.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), \frac{1}{2}\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(n, \frac{1}{2}\right)\right)\right) \]
    11. Applied egg-rr56.1%

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

    if 1.5499999999999999e260 < 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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f642.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified2.8%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{n \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right) \]
      10. PI-lowering-PI.f642.8%

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right) \]
    7. Applied egg-rr2.8%

      \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
    8. Step-by-step derivation
      1. pow1/2N/A

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

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

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

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

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

        \[\leadsto \mathsf{pow.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}} \cdot \frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\color{blue}{\frac{1}{2}} \cdot \frac{1}{2}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      11. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      15. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      16. metadata-eval33.3%

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \frac{1}{4}\right) \]
    9. Applied egg-rr33.3%

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

Alternative 5: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left({\left({k}^{\frac{1}{2}}\right)}^{-1}\right), \left(\frac{{\color{blue}{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}}^{\left(\frac{k}{2}\right)}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\frac{1}{2}}}\right)\right) \]
    10. pow-powN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, \left(\frac{1}{2} \cdot -1\right)\right), \left(\frac{\color{blue}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{k}{2}\right)}}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\frac{1}{2}}}\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, \frac{-1}{2}\right), \left(\frac{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\color{blue}{\left(\frac{k}{2}\right)}}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\frac{1}{2}}}\right)\right) \]
    13. clear-numN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, \frac{-1}{2}\right), \left(\frac{1}{\color{blue}{\frac{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\frac{1}{2}}}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{k}{2}\right)}}}}\right)\right) \]
    14. pow-subN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, \frac{-1}{2}\right), \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\color{blue}{\left(\frac{1}{2} - \frac{k}{2}\right)}}}\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, \frac{-1}{2}\right), \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1}{2} - \frac{\color{blue}{k}}{2}\right)}}\right)\right) \]
    16. div-subN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(k, \frac{-1}{2}\right), \left(\frac{1}{{\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)}^{\left(\frac{1 - k}{\color{blue}{2}}\right)}}\right)\right) \]
  4. Applied egg-rr99.1%

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

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

Alternative 6: 50.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.04 \cdot 10^{+260}:\\
\;\;\;\;\frac{\sqrt{n}}{\sqrt{\frac{k}{\frac{\pi}{0.5}}}}\\

\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\


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

    1. Initial program 99.0%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6441.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified41.2%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1}{k} \cdot 2\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{k}\right), 2\right)\right)\right) \]
      12. /-lowering-/.f6456.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, k\right), 2\right)\right)\right) \]
    7. Applied egg-rr56.1%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{k}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{2}{k}\right)\right)\right) \]
      3. /-lowering-/.f6456.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, k\right)\right)\right) \]
    9. Applied egg-rr56.1%

      \[\leadsto \sqrt{\pi \cdot n} \cdot \sqrt{\color{blue}{\frac{2}{k}}} \]
    10. Step-by-step derivation
      1. sqrt-unprodN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{2}{k}} \]
      2. clear-numN/A

        \[\leadsto \sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{1}{\frac{k}{2}}} \]
      3. div-invN/A

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{\frac{k}{2}}} \]
      5. associate-*r/N/A

        \[\leadsto \sqrt{n \cdot \frac{\mathsf{PI}\left(\right)}{\frac{k}{2}}} \]
      6. clear-numN/A

        \[\leadsto \sqrt{n \cdot \frac{1}{\frac{\frac{k}{2}}{\mathsf{PI}\left(\right)}}} \]
      7. un-div-invN/A

        \[\leadsto \sqrt{\frac{n}{\frac{\frac{k}{2}}{\mathsf{PI}\left(\right)}}} \]
      8. sqrt-divN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{n}\right), \left(\sqrt{\color{blue}{\frac{\frac{k}{2}}{\mathsf{PI}\left(\right)}}}\right)\right) \]
      12. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \left(\sqrt{\color{blue}{\frac{\frac{k}{2}}{\mathsf{PI}\left(\right)}}}\right)\right) \]
      13. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\left(\frac{\frac{k}{2}}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
      14. associate-/l/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\left(\frac{k}{\mathsf{PI}\left(\right) \cdot 2}\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\left(\frac{k}{2 \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
      16. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(k, \left(2 \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot 2\right)\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot \frac{1}{\frac{1}{2}}\right)\right)\right)\right) \]
      19. div-invN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(k, \left(\frac{\mathsf{PI}\left(\right)}{\frac{1}{2}}\right)\right)\right)\right) \]
      20. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(k, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), \frac{1}{2}\right)\right)\right)\right) \]
      21. PI-lowering-PI.f6456.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(k, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \frac{1}{2}\right)\right)\right)\right) \]
    11. Applied egg-rr56.1%

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

    if 1.04000000000000001e260 < 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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f642.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified2.8%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{n \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right) \]
      10. PI-lowering-PI.f642.8%

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right) \]
    7. Applied egg-rr2.8%

      \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
    8. Step-by-step derivation
      1. pow1/2N/A

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

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

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

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

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

        \[\leadsto \mathsf{pow.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}} \cdot \frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\color{blue}{\frac{1}{2}} \cdot \frac{1}{2}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      11. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      15. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      16. metadata-eval33.3%

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \frac{1}{4}\right) \]
    9. Applied egg-rr33.3%

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

Alternative 7: 50.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.12 \cdot 10^{+260}:\\
\;\;\;\;\sqrt{\pi \cdot n} \cdot \sqrt{\frac{2}{k}}\\

\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\


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

    1. Initial program 99.0%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6441.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified41.2%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1}{k} \cdot 2\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{k}\right), 2\right)\right)\right) \]
      12. /-lowering-/.f6456.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, k\right), 2\right)\right)\right) \]
    7. Applied egg-rr56.1%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{k}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{2}{k}\right)\right)\right) \]
      3. /-lowering-/.f6456.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, k\right)\right)\right) \]
    9. Applied egg-rr56.1%

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

    if 1.12e260 < 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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f642.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified2.8%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{n \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right) \]
      10. PI-lowering-PI.f642.8%

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right) \]
    7. Applied egg-rr2.8%

      \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
    8. Step-by-step derivation
      1. pow1/2N/A

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

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

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

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

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

        \[\leadsto \mathsf{pow.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}} \cdot \frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\color{blue}{\frac{1}{2}} \cdot \frac{1}{2}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      11. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      15. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      16. metadata-eval33.3%

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \frac{1}{4}\right) \]
    9. Applied egg-rr33.3%

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

Alternative 8: 50.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.04 \cdot 10^{+260}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\

\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\


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

    1. Initial program 99.0%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6441.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified41.2%

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

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

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

        \[\leadsto \sqrt{n \cdot \left(\frac{\mathsf{PI}\left(\right)}{k} \cdot 2\right)} \]
      4. sqrt-prodN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(n\right), \left(\sqrt{\color{blue}{\frac{\mathsf{PI}\left(\right)}{k} \cdot 2}}\right)\right) \]
      9. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\left(\frac{\mathsf{PI}\left(\right)}{k} \cdot 2\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{\mathsf{PI}\left(\right)}{k}\right), 2\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI}\left(\right), k\right), 2\right)\right)\right) \]
      12. PI-lowering-PI.f6455.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(n\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), k\right), 2\right)\right)\right) \]
    7. Applied egg-rr55.8%

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

    if 1.04000000000000001e260 < 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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f642.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified2.8%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{n \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right) \]
      10. PI-lowering-PI.f642.8%

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right) \]
    7. Applied egg-rr2.8%

      \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
    8. Step-by-step derivation
      1. pow1/2N/A

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

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

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

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

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

        \[\leadsto \mathsf{pow.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}} \cdot \frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\color{blue}{\frac{1}{2}} \cdot \frac{1}{2}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      11. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      15. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      16. metadata-eval33.3%

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \frac{1}{4}\right) \]
    9. Applied egg-rr33.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 1.04 \cdot 10^{+260}:\\ \;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{2}{\frac{k}{\pi \cdot n}} \cdot \frac{2}{\frac{k}{\pi \cdot n}}\right)}^{0.25}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 99.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\left(2 \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    8. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\frac{1 - k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    9. div-subN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \left(\frac{1}{2} - \frac{k}{2}\right)\right), \left(\sqrt{k}\right)\right) \]
    10. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\left(\frac{1}{2}\right), \left(\frac{k}{2}\right)\right)\right), \left(\sqrt{k}\right)\right) \]
    11. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \left(\frac{k}{2}\right)\right)\right), \left(\sqrt{k}\right)\right) \]
    12. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(k, 2\right)\right)\right), \left(\sqrt{k}\right)\right) \]
    13. sqrt-lowering-sqrt.f6499.1%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{pow.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{\_.f64}\left(\frac{1}{2}, \mathsf{/.f64}\left(k, 2\right)\right)\right), \mathsf{sqrt.f64}\left(k\right)\right) \]
  3. Simplified99.1%

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

Alternative 10: 39.6% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.15 \cdot 10^{+259}:\\
\;\;\;\;{\left(\frac{\frac{\frac{k}{n}}{\pi}}{2}\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\


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

    1. Initial program 99.0%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f6441.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified41.4%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1}{k} \cdot 2\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{k}\right), 2\right)\right)\right) \]
      12. /-lowering-/.f6456.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, k\right), 2\right)\right)\right) \]
    7. Applied egg-rr56.3%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{k}\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{2}{k}\right)\right)\right) \]
      3. /-lowering-/.f6456.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, k\right)\right)\right) \]
    9. Applied egg-rr56.3%

      \[\leadsto \sqrt{\pi \cdot n} \cdot \sqrt{\color{blue}{\frac{2}{k}}} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \sqrt{\frac{2}{k} \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)} \]
      3. associate-/r/N/A

        \[\leadsto \sqrt{\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}} \]
      4. clear-numN/A

        \[\leadsto \sqrt{\frac{1}{\frac{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}{2}}} \]
      5. inv-powN/A

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

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

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

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

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right), 2\right), \frac{-1}{2}\right) \]
      10. associate-/l/N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\left(\frac{\frac{k}{n}}{\mathsf{PI}\left(\right)}\right), 2\right), \frac{-1}{2}\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{k}{n}\right), \mathsf{PI}\left(\right)\right), 2\right), \frac{-1}{2}\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, n\right), \mathsf{PI}\left(\right)\right), 2\right), \frac{-1}{2}\right) \]
      13. PI-lowering-PI.f6442.2%

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, n\right), \mathsf{PI.f64}\left(\right)\right), 2\right), \frac{-1}{2}\right) \]
    11. Applied egg-rr42.2%

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

    if 1.1500000000000001e259 < 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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      5. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
      6. sqrt-lowering-sqrt.f642.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
    5. Simplified2.8%

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

        \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
      2. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{n \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right) \]
      10. PI-lowering-PI.f642.7%

        \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right) \]
    7. Applied egg-rr2.7%

      \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
    8. Step-by-step derivation
      1. pow1/2N/A

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

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

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

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

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

        \[\leadsto \mathsf{pow.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}} \cdot \frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right)}\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\color{blue}{\frac{1}{2}} \cdot \frac{1}{2}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      11. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \left(\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      15. PI-lowering-PI.f64N/A

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \left(\frac{1}{2} \cdot \frac{1}{2}\right)\right) \]
      16. metadata-eval31.9%

        \[\leadsto \mathsf{pow.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right), \mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right), \frac{1}{4}\right) \]
    9. Applied egg-rr31.9%

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

Alternative 11: 37.9% accurate, 2.0× speedup?

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    5. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    6. sqrt-lowering-sqrt.f6437.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
  5. Simplified37.9%

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

      \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
    2. div-invN/A

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1}{k} \cdot 2\right)\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{k}\right), 2\right)\right)\right) \]
    12. /-lowering-/.f6451.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(1, k\right), 2\right)\right)\right) \]
  7. Applied egg-rr51.5%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{k}\right)\right)\right) \]
    2. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\left(\frac{2}{k}\right)\right)\right) \]
    3. /-lowering-/.f6451.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, k\right)\right)\right) \]
  9. Applied egg-rr51.5%

    \[\leadsto \sqrt{\pi \cdot n} \cdot \sqrt{\color{blue}{\frac{2}{k}}} \]
  10. Step-by-step derivation
    1. *-commutativeN/A

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

      \[\leadsto \sqrt{\frac{2}{k} \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)} \]
    3. associate-/r/N/A

      \[\leadsto \sqrt{\frac{2}{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}} \]
    4. clear-numN/A

      \[\leadsto \sqrt{\frac{1}{\frac{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}{2}}} \]
    5. inv-powN/A

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

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

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

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

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right), 2\right), \frac{-1}{2}\right) \]
    10. associate-/l/N/A

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\left(\frac{\frac{k}{n}}{\mathsf{PI}\left(\right)}\right), 2\right), \frac{-1}{2}\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{k}{n}\right), \mathsf{PI}\left(\right)\right), 2\right), \frac{-1}{2}\right) \]
    12. /-lowering-/.f64N/A

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, n\right), \mathsf{PI}\left(\right)\right), 2\right), \frac{-1}{2}\right) \]
    13. PI-lowering-PI.f6438.6%

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, n\right), \mathsf{PI.f64}\left(\right)\right), 2\right), \frac{-1}{2}\right) \]
  11. Applied egg-rr38.6%

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

Alternative 12: 37.8% accurate, 2.0× speedup?

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    5. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    6. sqrt-lowering-sqrt.f6437.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
  5. Simplified37.9%

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

      \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2\right)\right) \]
    3. clear-numN/A

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

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{n \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right) \]
    10. PI-lowering-PI.f6438.1%

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right) \]
  7. Applied egg-rr38.1%

    \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
  8. Step-by-step derivation
    1. clear-numN/A

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

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

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

      \[\leadsto {\left(\frac{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}{2}\right)}^{\frac{-1}{2}} \]
    5. metadata-evalN/A

      \[\leadsto {\left(\frac{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}{2}\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
    6. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{pow.f64}\left(\left(\frac{\frac{k}{\mathsf{PI}\left(\right) \cdot n}}{2}\right), \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right), 2\right), \left(\mathsf{neg}\left(\color{blue}{\frac{1}{2}}\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right), 2\right), \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right), 2\right), \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right) \]
    10. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), 2\right), \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)\right) \]
    11. metadata-eval38.6%

      \[\leadsto \mathsf{pow.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right), 2\right), \frac{-1}{2}\right) \]
  9. Applied egg-rr38.6%

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

Alternative 13: 37.2% accurate, 2.0× speedup?

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

\\
\sqrt{n \cdot \frac{\pi}{\frac{k}{2}}}
\end{array}
Derivation
  1. Initial program 99.1%

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k}}\right), \color{blue}{\left(\sqrt{2}\right)}\right) \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k}\right)\right), \left(\sqrt{\color{blue}{2}}\right)\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\left(n \cdot \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    5. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \left(\sqrt{2}\right)\right) \]
    6. sqrt-lowering-sqrt.f6437.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(n, \mathsf{PI.f64}\left(\right)\right), k\right)\right), \mathsf{sqrt.f64}\left(2\right)\right) \]
  5. Simplified37.9%

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

      \[\leadsto \sqrt{\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2} \]
    2. sqrt-lowering-sqrt.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{n \cdot \mathsf{PI}\left(\right)}{k} \cdot 2\right)\right) \]
    3. clear-numN/A

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

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{1 \cdot 2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{\frac{k}{n \cdot \mathsf{PI}\left(\right)}}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{n \cdot \mathsf{PI}\left(\right)}\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \left(\frac{k}{\mathsf{PI}\left(\right) \cdot n}\right)\right)\right) \]
    8. /-lowering-/.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI}\left(\right), n\right)\right)\right)\right) \]
    10. PI-lowering-PI.f6438.1%

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(2, \mathsf{/.f64}\left(k, \mathsf{*.f64}\left(\mathsf{PI.f64}\left(\right), n\right)\right)\right)\right) \]
  7. Applied egg-rr38.1%

    \[\leadsto \color{blue}{\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
  8. Step-by-step derivation
    1. associate-/r/N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\left(\frac{2}{k} \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)\right)\right) \]
    2. metadata-evalN/A

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

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

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

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

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

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{k} \cdot 2\right)\right)\right)\right) \]
    8. associate-*l/N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \left(\mathsf{PI}\left(\right) \cdot \frac{1 \cdot 2}{k}\right)\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \left(\mathsf{PI}\left(\right) \cdot \frac{2}{k}\right)\right)\right) \]
    10. clear-numN/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \left(\mathsf{PI}\left(\right) \cdot \frac{1}{\frac{k}{2}}\right)\right)\right) \]
    11. un-div-invN/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \left(\frac{\mathsf{PI}\left(\right)}{\frac{k}{2}}\right)\right)\right) \]
    12. /-lowering-/.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \mathsf{/.f64}\left(\mathsf{PI}\left(\right), \left(\frac{k}{2}\right)\right)\right)\right) \]
    13. PI-lowering-PI.f64N/A

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \left(\frac{k}{2}\right)\right)\right)\right) \]
    14. /-lowering-/.f6438.1%

      \[\leadsto \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(n, \mathsf{/.f64}\left(\mathsf{PI.f64}\left(\right), \mathsf{/.f64}\left(k, 2\right)\right)\right)\right) \]
  9. Applied egg-rr38.1%

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

Reproduce

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