Migdal et al, Equation (51)

Percentage Accurate: 99.4% → 98.5%
Time: 14.0s
Alternatives: 9
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 9 alternatives:

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

Initial Program: 99.4% accurate, 1.0× speedup?

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

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

Alternative 1: 98.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.5000000000000003e-75 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt99.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.5% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 74.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.1:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0}\\


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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.10000000000000009 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n \cdot \pi}{k}}} \]
      2. expm1-log1p-u2.7%

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\pi \cdot \frac{n}{k}}\right)} - 1\right)} \]
      6. clear-num22.7%

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{1}{\frac{k}{n}}}\right)} - 1\right)} \]
      7. un-div-inv22.7%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\pi}{\frac{k}{n}}\right)} - 1\right)}} \]
    12. Step-by-step derivation
      1. sub-neg22.7%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{\mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)}\right)} \]
    13. Simplified22.7%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}} \]
    14. Taylor expanded in n around 0 51.1%

      \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{1}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 3.1:\\ \;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 74.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.2:\\
\;\;\;\;\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0}\\


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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\pi \cdot \frac{2}{k}}} \cdot \sqrt{n} \]
    13. Simplified96.7%

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

    if 3.2000000000000002 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n \cdot \pi}{k}}} \]
      2. expm1-log1p-u2.7%

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\pi \cdot \frac{n}{k}}\right)} - 1\right)} \]
      6. clear-num22.7%

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{1}{\frac{k}{n}}}\right)} - 1\right)} \]
      7. un-div-inv22.7%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\pi}{\frac{k}{n}}\right)} - 1\right)}} \]
    12. Step-by-step derivation
      1. sub-neg22.7%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{\mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)}\right)} \]
    13. Simplified22.7%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}} \]
    14. Taylor expanded in n around 0 51.1%

      \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{1}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 3.2:\\ \;\;\;\;\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0}\\ \end{array} \]
  5. Add Preprocessing

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

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

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

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

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

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

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

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

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

Alternative 6: 63.2% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.9:\\
\;\;\;\;\frac{1}{\sqrt{0.5 \cdot \frac{\frac{k}{\pi}}{n}}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0}\\


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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
    10. Taylor expanded in n around 0 74.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{1}{\frac{k}{\pi \cdot n}}}} \]
      6. div-inv74.5%

        \[\leadsto \sqrt{\color{blue}{\frac{2}{\frac{k}{\pi \cdot n}}}} \]
      7. clear-num74.5%

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

        \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{\frac{k}{\pi \cdot n}}{2}}}} \]
      9. metadata-eval75.5%

        \[\leadsto \frac{\color{blue}{1}}{\sqrt{\frac{\frac{k}{\pi \cdot n}}{2}}} \]
      10. div-inv75.5%

        \[\leadsto \frac{1}{\sqrt{\color{blue}{\frac{k}{\pi \cdot n} \cdot \frac{1}{2}}}} \]
      11. metadata-eval75.5%

        \[\leadsto \frac{1}{\sqrt{\frac{k}{\pi \cdot n} \cdot \color{blue}{0.5}}} \]
    14. Applied egg-rr75.5%

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

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

        \[\leadsto \frac{1}{\sqrt{0.5 \cdot \color{blue}{\frac{\frac{k}{\pi}}{n}}}} \]
    16. Simplified75.5%

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

    if 2.89999999999999991 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n \cdot \pi}{k}}} \]
      2. expm1-log1p-u2.7%

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\pi \cdot \frac{n}{k}}\right)} - 1\right)} \]
      6. clear-num22.7%

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{1}{\frac{k}{n}}}\right)} - 1\right)} \]
      7. un-div-inv22.7%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\pi}{\frac{k}{n}}\right)} - 1\right)}} \]
    12. Step-by-step derivation
      1. sub-neg22.7%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{\mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)}\right)} \]
    13. Simplified22.7%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}} \]
    14. Taylor expanded in n around 0 51.1%

      \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{1}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 2.9:\\ \;\;\;\;\frac{1}{\sqrt{0.5 \cdot \frac{\frac{k}{\pi}}{n}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 62.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.1:\\
\;\;\;\;\sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0}\\


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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot \left(\frac{n}{k} \cdot \pi\right)}} \]
    10. Taylor expanded in n around 0 74.5%

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

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

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

    if 3.10000000000000009 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n \cdot \pi}{k}}} \]
      2. expm1-log1p-u2.7%

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\pi \cdot \frac{n}{k}}\right)} - 1\right)} \]
      6. clear-num22.7%

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{1}{\frac{k}{n}}}\right)} - 1\right)} \]
      7. un-div-inv22.7%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\pi}{\frac{k}{n}}\right)} - 1\right)}} \]
    12. Step-by-step derivation
      1. sub-neg22.7%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{\mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)}\right)} \]
    13. Simplified22.7%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}} \]
    14. Taylor expanded in n around 0 51.1%

      \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{1}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 3.1:\\ \;\;\;\;\sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.1:\\
\;\;\;\;\sqrt{2 \cdot \frac{n}{\frac{k}{\pi}}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0}\\


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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

    if 3.10000000000000009 < k

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n \cdot \pi}{k}}} \]
      2. expm1-log1p-u2.7%

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\pi \cdot \frac{n}{k}}\right)} - 1\right)} \]
      6. clear-num22.7%

        \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{1}{\frac{k}{n}}}\right)} - 1\right)} \]
      7. un-div-inv22.7%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\pi}{\frac{k}{n}}\right)} - 1\right)}} \]
    12. Step-by-step derivation
      1. sub-neg22.7%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{\mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)}\right)} \]
    13. Simplified22.7%

      \[\leadsto \sqrt{2 \cdot \color{blue}{\left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}} \]
    14. Taylor expanded in n around 0 51.1%

      \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{1}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;k \leq 3.1:\\ \;\;\;\;\sqrt{2 \cdot \frac{n}{\frac{k}{\pi}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 27.2% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \sqrt{0} \end{array} \]
(FPCore (k n) :precision binary64 (sqrt 0.0))
double code(double k, double n) {
	return sqrt(0.0);
}
real(8) function code(k, n)
    real(8), intent (in) :: k
    real(8), intent (in) :: n
    code = sqrt(0.0d0)
end function
public static double code(double k, double n) {
	return Math.sqrt(0.0);
}
def code(k, n):
	return math.sqrt(0.0)
function code(k, n)
	return sqrt(0.0)
end
function tmp = code(k, n)
	tmp = sqrt(0.0);
end
code[k_, n_] := N[Sqrt[0.0], $MachinePrecision]
\begin{array}{l}

\\
\sqrt{0}
\end{array}
Derivation
  1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{n \cdot \pi}{k}}} \]
    2. expm1-log1p-u31.8%

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

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

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

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

      \[\leadsto \sqrt{2 \cdot \left(e^{\mathsf{log1p}\left(\pi \cdot \color{blue}{\frac{1}{\frac{k}{n}}}\right)} - 1\right)} \]
    7. un-div-inv34.1%

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

    \[\leadsto \sqrt{2 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\pi}{\frac{k}{n}}\right)} - 1\right)}} \]
  12. Step-by-step derivation
    1. sub-neg34.1%

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

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

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

      \[\leadsto \sqrt{2 \cdot \left(-1 + e^{\color{blue}{\log \left(1 + \frac{\pi}{\frac{k}{n}}\right)}}\right)} \]
    5. rem-exp-log35.6%

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

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

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

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

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

    \[\leadsto \sqrt{2 \cdot \color{blue}{\left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}} \]
  14. Taylor expanded in n around 0 30.5%

    \[\leadsto \sqrt{2 \cdot \left(-1 + \color{blue}{1}\right)} \]
  15. Final simplification30.5%

    \[\leadsto \sqrt{0} \]
  16. Add Preprocessing

Reproduce

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