
(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 (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.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.6%
pow1/299.6%
associate-*r/99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
(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.5%
associate-*l/99.5%
*-un-lft-identity99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.7%
pow1/299.7%
associate-/l/99.6%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
associate-/l/99.7%
unpow1/299.7%
metadata-eval99.7%
pow-sqr99.5%
fabs-sqr99.5%
pow-sqr99.7%
metadata-eval99.7%
unpow1/299.7%
fabs-neg99.7%
neg-mul-199.7%
rem-square-sqrt0.0%
unpow1/20.0%
metadata-eval0.0%
pow-sqr0.0%
unswap-sqr0.0%
fabs-sqr0.0%
unswap-sqr0.0%
rem-square-sqrt24.8%
pow-sqr24.8%
metadata-eval24.8%
unpow1/224.8%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 9.6e+58) (* (pow k -0.5) (sqrt (* n (* 2.0 PI)))) (sqrt (* 2.0 (+ -1.0 (fma n (/ PI k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 9.6e+58) {
tmp = pow(k, -0.5) * sqrt((n * (2.0 * ((double) M_PI))));
} else {
tmp = sqrt((2.0 * (-1.0 + fma(n, (((double) M_PI) / k), 1.0))));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 9.6e+58) tmp = Float64((k ^ -0.5) * sqrt(Float64(n * Float64(2.0 * pi)))); else tmp = sqrt(Float64(2.0 * Float64(-1.0 + fma(n, Float64(pi / k), 1.0)))); end return tmp end
code[k_, n_] := If[LessEqual[k, 9.6e+58], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(-1.0 + N[(n * N[(Pi / k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 9.6 \cdot 10^{+58}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{n \cdot \left(2 \cdot \pi\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 9.5999999999999999e58Initial program 99.2%
Taylor expanded in k around 0 60.5%
associate-/l*60.6%
Simplified60.6%
pow160.6%
sqrt-unprod60.6%
clear-num60.6%
un-div-inv60.7%
Applied egg-rr60.7%
unpow160.7%
*-commutative60.7%
associate-/r/60.7%
Simplified60.7%
*-commutative60.7%
sqrt-prod60.5%
associate-*l/60.5%
*-commutative60.5%
sqrt-div82.2%
*-commutative82.2%
*-un-lft-identity82.2%
associate-*l/82.2%
associate-*r*82.1%
pow1/282.1%
pow-flip82.2%
metadata-eval82.2%
sqrt-unprod82.4%
*-commutative82.4%
associate-*r*82.4%
*-commutative82.4%
associate-*l*82.4%
Applied egg-rr82.4%
if 9.5999999999999999e58 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
associate-/l*2.7%
Simplified2.7%
pow12.7%
sqrt-unprod2.7%
clear-num2.7%
un-div-inv2.7%
Applied egg-rr2.7%
unpow12.7%
*-commutative2.7%
associate-/r/2.7%
Simplified2.7%
expm1-log1p-u2.7%
expm1-undefine30.5%
*-commutative30.5%
Applied egg-rr30.5%
sub-neg30.5%
metadata-eval30.5%
+-commutative30.5%
log1p-undefine30.5%
rem-exp-log30.5%
+-commutative30.5%
*-commutative30.5%
associate-*l/30.5%
associate-*r/30.5%
fma-define30.5%
Simplified30.5%
(FPCore (k n) :precision binary64 (if (<= k 1.7e+262) (* (pow k -0.5) (sqrt (* n (* 2.0 PI)))) (cbrt (pow (* PI (* n (/ 2.0 k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 1.7e+262) {
tmp = pow(k, -0.5) * sqrt((n * (2.0 * ((double) M_PI))));
} else {
tmp = cbrt(pow((((double) M_PI) * (n * (2.0 / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.7e+262) {
tmp = Math.pow(k, -0.5) * Math.sqrt((n * (2.0 * Math.PI)));
} else {
tmp = Math.cbrt(Math.pow((Math.PI * (n * (2.0 / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.7e+262) tmp = Float64((k ^ -0.5) * sqrt(Float64(n * Float64(2.0 * pi)))); else tmp = cbrt((Float64(pi * Float64(n * Float64(2.0 / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.7e+262], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(Pi * N[(n * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.7 \cdot 10^{+262}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{n \cdot \left(2 \cdot \pi\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(\pi \cdot \left(n \cdot \frac{2}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 1.7000000000000001e262Initial program 99.5%
Taylor expanded in k around 0 42.6%
associate-/l*42.6%
Simplified42.6%
pow142.6%
sqrt-unprod42.7%
clear-num42.7%
un-div-inv42.7%
Applied egg-rr42.7%
unpow142.7%
*-commutative42.7%
associate-/r/42.7%
Simplified42.7%
*-commutative42.7%
sqrt-prod42.6%
associate-*l/42.6%
*-commutative42.6%
sqrt-div57.6%
*-commutative57.6%
*-un-lft-identity57.6%
associate-*l/57.6%
associate-*r*57.6%
pow1/257.6%
pow-flip57.6%
metadata-eval57.6%
sqrt-unprod57.8%
*-commutative57.8%
associate-*r*57.8%
*-commutative57.8%
associate-*l*57.8%
Applied egg-rr57.8%
if 1.7000000000000001e262 < k Initial program 100.0%
Taylor expanded in k around 0 3.2%
associate-/l*3.2%
Simplified3.2%
pow13.2%
sqrt-unprod3.2%
clear-num3.2%
un-div-inv3.2%
Applied egg-rr3.2%
unpow13.2%
*-commutative3.2%
associate-/r/3.2%
Simplified3.2%
associate-*l/3.2%
*-commutative3.2%
associate-*r/3.2%
*-commutative3.2%
associate-*r*3.2%
add-cbrt-cube31.8%
pow1/331.8%
Applied egg-rr31.8%
unpow1/331.8%
associate-/r*31.8%
associate-/r/31.8%
metadata-eval31.8%
associate-*r/31.8%
*-commutative31.8%
associate-*l*31.8%
associate-*r/31.8%
metadata-eval31.8%
Simplified31.8%
(FPCore (k n) :precision binary64 (if (<= k 4.4e+260) (* (sqrt (/ 2.0 k)) (sqrt (* PI n))) (cbrt (pow (* PI (* n (/ 2.0 k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 4.4e+260) {
tmp = sqrt((2.0 / k)) * sqrt((((double) M_PI) * n));
} else {
tmp = cbrt(pow((((double) M_PI) * (n * (2.0 / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.4e+260) {
tmp = Math.sqrt((2.0 / k)) * Math.sqrt((Math.PI * n));
} else {
tmp = Math.cbrt(Math.pow((Math.PI * (n * (2.0 / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 4.4e+260) tmp = Float64(sqrt(Float64(2.0 / k)) * sqrt(Float64(pi * n))); else tmp = cbrt((Float64(pi * Float64(n * Float64(2.0 / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 4.4e+260], N[(N[Sqrt[N[(2.0 / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(Pi * N[(n * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.4 \cdot 10^{+260}:\\
\;\;\;\;\sqrt{\frac{2}{k}} \cdot \sqrt{\pi \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(\pi \cdot \left(n \cdot \frac{2}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 4.40000000000000023e260Initial program 99.5%
Taylor expanded in k around 0 42.6%
associate-/l*42.6%
Simplified42.6%
pow142.6%
sqrt-unprod42.7%
clear-num42.7%
un-div-inv42.7%
Applied egg-rr42.7%
unpow142.7%
*-commutative42.7%
associate-/r/42.7%
Simplified42.7%
*-commutative42.7%
clear-num42.7%
un-div-inv42.7%
Applied egg-rr42.7%
clear-num42.7%
associate-/r*42.7%
div-inv42.7%
associate-/r/42.6%
*-commutative42.6%
sqrt-prod57.7%
*-commutative57.7%
Applied egg-rr57.7%
if 4.40000000000000023e260 < k Initial program 100.0%
Taylor expanded in k around 0 3.2%
associate-/l*3.2%
Simplified3.2%
pow13.2%
sqrt-unprod3.2%
clear-num3.2%
un-div-inv3.2%
Applied egg-rr3.2%
unpow13.2%
*-commutative3.2%
associate-/r/3.2%
Simplified3.2%
associate-*l/3.2%
*-commutative3.2%
associate-*r/3.2%
*-commutative3.2%
associate-*r*3.2%
add-cbrt-cube31.8%
pow1/331.8%
Applied egg-rr31.8%
unpow1/331.8%
associate-/r*31.8%
associate-/r/31.8%
metadata-eval31.8%
associate-*r/31.8%
*-commutative31.8%
associate-*l*31.8%
associate-*r/31.8%
metadata-eval31.8%
Simplified31.8%
Final simplification55.7%
(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.5%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
div-inv99.5%
div-inv99.5%
metadata-eval99.5%
pow1/299.5%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification99.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.5%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
(FPCore (k n) :precision binary64 (* (sqrt (/ 2.0 k)) (sqrt (* PI n))))
double code(double k, double n) {
return sqrt((2.0 / k)) * sqrt((((double) M_PI) * n));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 / k)) * Math.sqrt((Math.PI * n));
}
def code(k, n): return math.sqrt((2.0 / k)) * math.sqrt((math.pi * n))
function code(k, n) return Float64(sqrt(Float64(2.0 / k)) * sqrt(Float64(pi * n))) end
function tmp = code(k, n) tmp = sqrt((2.0 / k)) * sqrt((pi * n)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{2}{k}} \cdot \sqrt{\pi \cdot n}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.5%
associate-/l*39.6%
Simplified39.6%
pow139.6%
sqrt-unprod39.6%
clear-num39.6%
un-div-inv39.6%
Applied egg-rr39.6%
unpow139.6%
*-commutative39.6%
associate-/r/39.6%
Simplified39.6%
*-commutative39.6%
clear-num39.6%
un-div-inv39.6%
Applied egg-rr39.6%
clear-num39.6%
associate-/r*39.6%
div-inv39.6%
associate-/r/39.6%
*-commutative39.6%
sqrt-prod53.4%
*-commutative53.4%
Applied egg-rr53.4%
Final simplification53.4%
(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.5%
Taylor expanded in k around 0 39.5%
associate-/l*39.6%
Simplified39.6%
pow139.6%
sqrt-unprod39.6%
clear-num39.6%
un-div-inv39.6%
Applied egg-rr39.6%
unpow139.6%
*-commutative39.6%
associate-/r/39.6%
Simplified39.6%
*-commutative39.6%
sqrt-prod39.5%
associate-*l/39.5%
*-commutative39.5%
sqrt-div53.4%
*-commutative53.4%
*-un-lft-identity53.4%
associate-*l/53.3%
associate-*r*53.3%
associate-*l/53.3%
*-un-lft-identity53.3%
clear-num53.3%
sqrt-unprod53.4%
*-commutative53.4%
associate-*r*53.4%
*-commutative53.4%
associate-*l*53.4%
Applied egg-rr53.4%
inv-pow53.4%
sqrt-undiv39.8%
sqrt-pow239.9%
metadata-eval39.9%
Applied egg-rr39.9%
(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.5%
Taylor expanded in k around 0 39.5%
associate-/l*39.6%
Simplified39.6%
pow139.6%
sqrt-unprod39.6%
clear-num39.6%
un-div-inv39.6%
Applied egg-rr39.6%
unpow139.6%
*-commutative39.6%
associate-/r/39.6%
Simplified39.6%
Final simplification39.6%
herbie shell --seed 2024110
(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))))