
(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 11 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 (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.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
pow-div99.7%
pow1/299.7%
associate-*r/99.7%
pow1/299.7%
pow-flip99.8%
metadata-eval99.8%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
(FPCore (k n) :precision binary64 (let* ((t_0 (* 2.0 (* PI n)))) (/ (sqrt t_0) (* (pow t_0 (* k 0.5)) (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 * 0.5)) * 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 * 0.5)) * Math.sqrt(k));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return math.sqrt(t_0) / (math.pow(t_0, (k * 0.5)) * math.sqrt(k))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(sqrt(t_0) / Float64((t_0 ^ Float64(k * 0.5)) * sqrt(k))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = sqrt(t_0) / ((t_0 ^ (k * 0.5)) * sqrt(k)); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision] * N[Sqrt[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{\sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)} \cdot \sqrt{k}}
\end{array}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
pow-div99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 2.1e-49) (* (sqrt (* 2.0 n)) (sqrt (/ PI k))) (sqrt (/ (pow (* 2.0 (* PI n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 2.1e-49) {
tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
} 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 <= 2.1e-49) {
tmp = Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
} 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 <= 2.1e-49: tmp = math.sqrt((2.0 * n)) * math.sqrt((math.pi / k)) 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 <= 2.1e-49) tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))); 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 <= 2.1e-49) tmp = sqrt((2.0 * n)) * sqrt((pi / k)); else tmp = sqrt((((2.0 * (pi * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.1e-49], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $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 2.1 \cdot 10^{-49}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 2.0999999999999999e-49Initial program 99.3%
Taylor expanded in k around 0 71.5%
associate-/l*71.5%
Simplified71.5%
*-commutative71.5%
sqrt-unprod71.9%
Applied egg-rr71.9%
pow1/271.9%
associate-*r*71.9%
unpow-prod-down99.6%
pow1/299.6%
Applied egg-rr99.6%
unpow1/299.6%
*-commutative99.6%
Simplified99.6%
if 2.0999999999999999e-49 < k Initial program 99.8%
Applied egg-rr99.2%
*-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
*-commutative99.2%
associate-*r*99.2%
metadata-eval99.2%
neg-mul-199.2%
sub-neg99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (k n) :precision binary64 (if (<= k 6.8e+28) (* (sqrt (* 2.0 n)) (sqrt (/ PI k))) (sqrt (+ -1.0 (fma n (* PI (/ 2.0 k)) 1.0)))))
double code(double k, double n) {
double tmp;
if (k <= 6.8e+28) {
tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
} 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 <= 6.8e+28) tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))); 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, 6.8e+28], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $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 6.8 \cdot 10^{+28}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{-1 + \mathsf{fma}\left(n, \pi \cdot \frac{2}{k}, 1\right)}\\
\end{array}
\end{array}
if k < 6.8e28Initial program 99.2%
Taylor expanded in k around 0 66.8%
associate-/l*66.8%
Simplified66.8%
*-commutative66.8%
sqrt-unprod67.1%
Applied egg-rr67.1%
pow1/267.1%
associate-*r*67.1%
unpow-prod-down88.1%
pow1/288.1%
Applied egg-rr88.1%
unpow1/288.1%
*-commutative88.1%
Simplified88.1%
if 6.8e28 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
associate-/l*2.7%
Simplified2.7%
*-commutative2.7%
sqrt-unprod2.7%
Applied egg-rr2.7%
associate-*r/2.7%
*-commutative2.7%
associate-*r/2.7%
associate-*r*2.7%
*-commutative2.7%
expm1-log1p-u2.7%
expm1-undefine29.0%
Applied egg-rr29.0%
sub-neg29.0%
metadata-eval29.0%
+-commutative29.0%
log1p-undefine29.0%
rem-exp-log29.0%
+-commutative29.0%
associate-*r*29.0%
associate-*r/29.0%
associate-*l/29.0%
*-commutative29.0%
associate-*r*29.0%
*-commutative29.0%
fma-define29.0%
*-commutative29.0%
associate-*l/29.0%
associate-*r/29.0%
Simplified29.0%
Final simplification58.8%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (+ 0.5 (* k -0.5)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), (0.5 + (k * -0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), (0.5 + (k * -0.5)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), (0.5 + (k * -0.5)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 + Float64(k * -0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ (0.5 + (k * -0.5))); 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 * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 + k \cdot -0.5\right)}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
metadata-eval99.6%
div-sub99.6%
associate-*r*99.6%
div-inv99.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
sub-neg99.6%
div-inv99.6%
metadata-eval99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.7%
(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.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 n)) (sqrt (/ PI k))))
double code(double k, double n) {
return sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
}
def code(k, n): return math.sqrt((2.0 * n)) * math.sqrt((math.pi / k))
function code(k, n) return Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt((2.0 * n)) * sqrt((pi / k)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 35.0%
associate-/l*35.0%
Simplified35.0%
*-commutative35.0%
sqrt-unprod35.2%
Applied egg-rr35.2%
pow1/235.2%
associate-*r*35.2%
unpow-prod-down45.8%
pow1/245.8%
Applied egg-rr45.8%
unpow1/245.8%
*-commutative45.8%
Simplified45.8%
Final simplification45.8%
(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.6%
Taylor expanded in k around 0 35.0%
associate-/l*35.0%
Simplified35.0%
*-commutative35.0%
sqrt-unprod35.2%
Applied egg-rr35.2%
*-commutative35.2%
associate-*r/35.1%
*-commutative35.1%
sqrt-unprod35.0%
add-cbrt-cube26.1%
pow1/324.6%
Applied egg-rr24.6%
unpow1/326.1%
*-commutative26.1%
*-commutative26.1%
associate-*r/26.1%
associate-/r/26.1%
*-commutative26.1%
associate-/l*26.2%
Simplified26.2%
pow1/324.6%
pow-pow35.2%
metadata-eval35.2%
pow1/235.2%
*-commutative35.2%
sqrt-prod45.8%
div-inv45.8%
clear-num45.7%
Applied egg-rr45.7%
(FPCore (k n) :precision binary64 (pow (* k (/ 0.5 (* PI n))) -0.5))
double code(double k, double n) {
return pow((k * (0.5 / (((double) M_PI) * n))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k * (0.5 / (Math.PI * n))), -0.5);
}
def code(k, n): return math.pow((k * (0.5 / (math.pi * n))), -0.5)
function code(k, n) return Float64(k * Float64(0.5 / Float64(pi * n))) ^ -0.5 end
function tmp = code(k, n) tmp = (k * (0.5 / (pi * n))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k * N[(0.5 / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{0.5}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 35.0%
associate-/l*35.0%
Simplified35.0%
*-commutative35.0%
sqrt-unprod35.2%
Applied egg-rr35.2%
Taylor expanded in n around 0 35.1%
associate-*l/35.1%
associate-/r/35.2%
Simplified35.2%
associate-/r/35.1%
associate-*r*35.1%
*-commutative35.1%
*-commutative35.1%
associate-*l/35.1%
associate-*r/35.1%
associate-*l*35.1%
*-commutative35.1%
clear-num35.1%
metadata-eval35.1%
add-sqr-sqrt35.0%
frac-times35.1%
sqrt-unprod35.5%
add-sqr-sqrt35.6%
inv-pow35.6%
sqrt-pow235.7%
Applied egg-rr35.7%
*-commutative35.7%
associate-*l/35.7%
associate-/l*35.7%
Simplified35.7%
Final simplification35.7%
(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.6%
Taylor expanded in k around 0 35.0%
associate-/l*35.0%
Simplified35.0%
*-commutative35.0%
sqrt-unprod35.2%
Applied egg-rr35.2%
Taylor expanded in n around 0 35.1%
associate-*l/35.1%
associate-/r/35.2%
Simplified35.2%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (* n (/ PI k)))))
double code(double k, double n) {
return sqrt((2.0 * (n * (((double) M_PI) / k))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (n * (Math.PI / k))));
}
def code(k, n): return math.sqrt((2.0 * (n * (math.pi / k))))
function code(k, n) return sqrt(Float64(2.0 * Float64(n * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (n * (pi / k)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 35.0%
associate-/l*35.0%
Simplified35.0%
*-commutative35.0%
sqrt-unprod35.2%
Applied egg-rr35.2%
herbie shell --seed 2024187
(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))))