
(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:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (k n) :precision binary64 (if (<= k 6e-61) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (sqrt (/ (pow (* PI (* 2.0 n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 6e-61) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} else {
tmp = sqrt((pow((((double) M_PI) * (2.0 * n)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 6e-61) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} else {
tmp = Math.sqrt((Math.pow((Math.PI * (2.0 * n)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 6e-61: tmp = math.sqrt((2.0 * n)) / math.sqrt((k / math.pi)) else: tmp = math.sqrt((math.pow((math.pi * (2.0 * n)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 6e-61) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = sqrt(Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 6e-61) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); else tmp = sqrt((((pi * (2.0 * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 6e-61], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6 \cdot 10^{-61}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 6.00000000000000024e-61Initial program 98.3%
Taylor expanded in k around 0 74.6%
*-commutative74.6%
associate-/l*74.7%
Simplified74.7%
pow174.7%
sqrt-unprod73.8%
Applied egg-rr73.8%
unpow173.8%
associate-*r/73.8%
*-commutative73.8%
associate-/l*73.8%
Simplified73.8%
associate-*r/73.8%
*-commutative73.8%
associate-/l*73.8%
clear-num73.8%
un-div-inv73.9%
Applied egg-rr73.9%
associate-*r/73.9%
*-commutative73.9%
sqrt-div99.4%
Applied egg-rr99.4%
if 6.00000000000000024e-61 < k Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
div-inv99.6%
metadata-eval99.6%
div-sub99.6%
sqr-pow99.6%
associate-*l*99.6%
div-inv99.6%
metadata-eval99.6%
associate-/l*99.6%
metadata-eval99.6%
Applied egg-rr99.6%
associate-*r*99.6%
pow-sqr99.6%
associate-*r*99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
metadata-eval99.6%
Simplified99.6%
Applied egg-rr99.7%
unpow199.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (k n) :precision binary64 (let* ((t_0 (* 2.0 (* PI n)))) (/ (* (pow k -0.5) (sqrt t_0)) (pow t_0 (* k 0.5)))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return (pow(k, -0.5) * sqrt(t_0)) / pow(t_0, (k * 0.5));
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI * n);
return (Math.pow(k, -0.5) * Math.sqrt(t_0)) / Math.pow(t_0, (k * 0.5));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.pow(k, -0.5) * math.sqrt(t_0)) / math.pow(t_0, (k * 0.5))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64((k ^ -0.5) * sqrt(t_0)) / (t_0 ^ Float64(k * 0.5))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = ((k ^ -0.5) * sqrt(t_0)) / (t_0 ^ (k * 0.5)); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{{k}^{-0.5} \cdot \sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.1%
associate-*r*99.1%
div-sub99.1%
metadata-eval99.1%
pow-div99.3%
pow1/299.3%
associate-*r/99.3%
inv-pow99.3%
sqrt-pow299.3%
metadata-eval99.3%
div-inv99.3%
metadata-eval99.3%
Applied egg-rr99.3%
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* 2.0 PI)))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = n * (2.0 * ((double) M_PI));
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = n * (2.0 * Math.PI);
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = n * (2.0 * math.pi) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = n * (2.0 * pi); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(N[Sqrt[k], $MachinePrecision] * N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k} \cdot {t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.1%
associate-*l/99.2%
*-un-lft-identity99.2%
associate-*r*99.2%
div-sub99.2%
metadata-eval99.2%
pow-div99.3%
pow1/299.3%
associate-/l/99.3%
div-inv99.3%
metadata-eval99.3%
Applied egg-rr99.3%
associate-/l/99.3%
rem-square-sqrt99.3%
rem-sqrt-square99.3%
fabs-neg99.3%
neg-mul-199.3%
rem-square-sqrt0.0%
unpow1/20.0%
metadata-eval0.0%
pow-sqr0.0%
unswap-sqr0.0%
fabs-sqr0.0%
unswap-sqr0.0%
rem-square-sqrt27.9%
pow-sqr27.9%
metadata-eval27.9%
unpow1/227.9%
neg-mul-127.9%
associate-/r*27.9%
Simplified99.3%
Final simplification99.3%
(FPCore (k n) :precision binary64 (if (<= k 1.85e+21) (* (sqrt (* 2.0 (/ PI k))) (sqrt n)) (sqrt (+ -1.0 (fma n (* PI (/ 2.0 k)) 1.0)))))
double code(double k, double n) {
double tmp;
if (k <= 1.85e+21) {
tmp = sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
} else {
tmp = sqrt((-1.0 + fma(n, (((double) M_PI) * (2.0 / k)), 1.0)));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.85e+21) tmp = Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)); else tmp = sqrt(Float64(-1.0 + fma(n, Float64(pi * Float64(2.0 / k)), 1.0))); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.85e+21], N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(-1.0 + N[(n * N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.85 \cdot 10^{+21}:\\
\;\;\;\;\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{-1 + \mathsf{fma}\left(n, \pi \cdot \frac{2}{k}, 1\right)}\\
\end{array}
\end{array}
if k < 1.85e21Initial program 98.4%
Taylor expanded in k around 0 71.9%
*-commutative71.9%
associate-/l*71.8%
Simplified71.8%
pow171.8%
sqrt-unprod71.3%
Applied egg-rr71.3%
unpow171.3%
associate-*r/71.3%
*-commutative71.3%
associate-/l*71.3%
Simplified71.3%
sqrt-prod71.8%
associate-*r/71.9%
sqrt-div88.9%
sqrt-prod89.7%
associate-*l/89.7%
sqrt-div89.7%
associate-*r*89.7%
sqrt-unprod89.8%
Applied egg-rr89.8%
if 1.85e21 < k Initial program 100.0%
Taylor expanded in k around 0 2.6%
*-commutative2.6%
associate-/l*2.6%
Simplified2.6%
pow12.6%
sqrt-unprod2.6%
Applied egg-rr2.6%
unpow12.6%
associate-*r/2.6%
*-commutative2.6%
associate-/l*2.6%
Simplified2.6%
associate-*r*2.6%
associate-*r/2.6%
*-commutative2.6%
Applied egg-rr2.6%
associate-*r*2.6%
associate-/l*2.6%
clear-num2.6%
div-inv2.6%
expm1-log1p-u2.6%
*-commutative2.6%
associate-*r/2.6%
expm1-undefine25.6%
associate-*r/25.6%
*-commutative25.6%
div-inv25.6%
clear-num25.6%
associate-/l*25.6%
associate-*r*25.6%
associate-/l*25.6%
Applied egg-rr25.6%
sub-neg25.6%
metadata-eval25.6%
+-commutative25.6%
log1p-undefine25.6%
rem-exp-log25.6%
+-commutative25.6%
fma-define25.6%
*-commutative25.6%
associate-/l*25.6%
Simplified25.6%
(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}
Initial program 99.1%
associate-*l/99.2%
*-lft-identity99.2%
associate-*l*99.2%
div-sub99.2%
metadata-eval99.2%
Simplified99.2%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 (/ PI k))) (sqrt n)))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(n);
}
def code(k, n): return math.sqrt((2.0 * (math.pi / k))) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 39.1%
*-commutative39.1%
associate-/l*39.1%
Simplified39.1%
pow139.1%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
Simplified38.8%
sqrt-prod39.1%
associate-*r/39.1%
sqrt-div48.2%
sqrt-prod48.6%
associate-*l/48.6%
sqrt-div48.6%
associate-*r*48.6%
sqrt-unprod48.6%
Applied egg-rr48.6%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* PI (/ 2.0 k)))))
double code(double k, double n) {
return sqrt(n) * sqrt((((double) M_PI) * (2.0 / k)));
}
public static double code(double k, double n) {
return Math.sqrt(n) * Math.sqrt((Math.PI * (2.0 / k)));
}
def code(k, n): return math.sqrt(n) * math.sqrt((math.pi * (2.0 / k)))
function code(k, n) return Float64(sqrt(n) * sqrt(Float64(pi * Float64(2.0 / k)))) end
function tmp = code(k, n) tmp = sqrt(n) * sqrt((pi * (2.0 / k))); end
code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 39.1%
*-commutative39.1%
associate-/l*39.1%
Simplified39.1%
pow139.1%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
Simplified38.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
clear-num38.8%
un-div-inv38.8%
Applied egg-rr38.8%
pow1/238.8%
associate-*r/38.8%
*-commutative38.8%
div-inv38.8%
clear-num38.8%
div-inv38.8%
associate-*l*38.8%
associate-*r*38.8%
div-inv38.8%
associate-/l*38.8%
unpow-prod-down48.6%
pow1/248.6%
Applied egg-rr48.6%
unpow1/248.6%
*-commutative48.6%
associate-/l*48.6%
Simplified48.6%
(FPCore (k n) :precision binary64 (pow (/ k (* n (* 2.0 PI))) -0.5))
double code(double k, double n) {
return pow((k / (n * (2.0 * ((double) M_PI)))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / (n * (2.0 * Math.PI))), -0.5);
}
def code(k, n): return math.pow((k / (n * (2.0 * math.pi))), -0.5)
function code(k, n) return Float64(k / Float64(n * Float64(2.0 * pi))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (n * (2.0 * pi))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{n \cdot \left(2 \cdot \pi\right)}\right)}^{-0.5}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 39.1%
*-commutative39.1%
associate-/l*39.1%
Simplified39.1%
pow139.1%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
Simplified38.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
clear-num38.8%
un-div-inv38.8%
Applied egg-rr38.8%
div-inv38.8%
clear-num38.8%
associate-*r*38.8%
*-commutative38.8%
associate-/l*38.8%
associate-*r*38.8%
sqrt-div48.3%
clear-num48.2%
inv-pow48.2%
sqrt-undiv39.8%
sqrt-pow239.9%
associate-/r*39.9%
metadata-eval39.9%
Applied egg-rr39.9%
associate-/r*39.9%
Simplified39.9%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ n (/ k PI)))))
double code(double k, double n) {
return sqrt((2.0 * (n / (k / ((double) M_PI)))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (n / (k / Math.PI))));
}
def code(k, n): return math.sqrt((2.0 * (n / (k / math.pi))))
function code(k, n) return sqrt(Float64(2.0 * Float64(n / Float64(k / pi)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (n / (k / pi)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n / N[(k / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{n}{\frac{k}{\pi}}}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 39.1%
*-commutative39.1%
associate-/l*39.1%
Simplified39.1%
pow139.1%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
Simplified38.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
clear-num38.8%
un-div-inv38.8%
Applied egg-rr38.8%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (* PI (/ n k)))))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) * (n / k))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI * (n / k))));
}
def code(k, n): return math.sqrt((2.0 * (math.pi * (n / k))))
function code(k, n) return sqrt(Float64(2.0 * Float64(pi * Float64(n / k)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi * (n / k)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 39.1%
*-commutative39.1%
associate-/l*39.1%
Simplified39.1%
pow139.1%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*r/38.8%
*-commutative38.8%
associate-/l*38.8%
Simplified38.8%
herbie shell --seed 2024139
(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))))