
(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 (* n (* PI 2.0)))) (/ (sqrt t_0) (sqrt (* k (pow t_0 k))))))
double code(double k, double n) {
double t_0 = n * (((double) M_PI) * 2.0);
return sqrt(t_0) / sqrt((k * pow(t_0, k)));
}
public static double code(double k, double n) {
double t_0 = n * (Math.PI * 2.0);
return Math.sqrt(t_0) / Math.sqrt((k * Math.pow(t_0, k)));
}
def code(k, n): t_0 = n * (math.pi * 2.0) return math.sqrt(t_0) / math.sqrt((k * math.pow(t_0, k)))
function code(k, n) t_0 = Float64(n * Float64(pi * 2.0)) return Float64(sqrt(t_0) / sqrt(Float64(k * (t_0 ^ k)))) end
function tmp = code(k, n) t_0 = n * (pi * 2.0); tmp = sqrt(t_0) / sqrt((k * (t_0 ^ k))); end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[N[(k * N[Power[t$95$0, k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(\pi \cdot 2\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k \cdot {t\_0}^{k}}}
\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.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
associate-*r*99.7%
Simplified99.7%
div-inv99.7%
associate-*r*99.7%
add-sqr-sqrt99.4%
sqrt-unprod99.7%
swap-sqr99.7%
add-sqr-sqrt99.7%
pow-unpow99.7%
pow-unpow99.7%
pow-prod-up99.7%
metadata-eval99.7%
pow199.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
*-commutative99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 1e-59) (/ (sqrt (* PI (* n 2.0))) (sqrt k)) (sqrt (/ (pow (* n (* PI 2.0)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 1e-59) {
tmp = sqrt((((double) M_PI) * (n * 2.0))) / sqrt(k);
} else {
tmp = sqrt((pow((n * (((double) M_PI) * 2.0)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1e-59) {
tmp = Math.sqrt((Math.PI * (n * 2.0))) / Math.sqrt(k);
} else {
tmp = Math.sqrt((Math.pow((n * (Math.PI * 2.0)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1e-59: tmp = math.sqrt((math.pi * (n * 2.0))) / math.sqrt(k) else: tmp = math.sqrt((math.pow((n * (math.pi * 2.0)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 1e-59) tmp = Float64(sqrt(Float64(pi * Float64(n * 2.0))) / sqrt(k)); else tmp = sqrt(Float64((Float64(n * Float64(pi * 2.0)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1e-59) tmp = sqrt((pi * (n * 2.0))) / sqrt(k); else tmp = sqrt((((n * (pi * 2.0)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1e-59], N[(N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 10^{-59}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(n \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 1e-59Initial program 99.4%
add-sqr-sqrt98.8%
sqrt-unprod73.9%
*-commutative73.9%
associate-*r*73.9%
div-sub73.9%
metadata-eval73.9%
div-inv73.9%
*-commutative73.9%
Applied egg-rr73.8%
Simplified73.9%
Taylor expanded in k around 0 73.9%
associate-*r/74.0%
*-commutative74.0%
associate-*l*74.0%
Simplified74.0%
Taylor expanded in n around 0 73.9%
*-commutative73.9%
associate-*r/74.0%
Simplified74.0%
associate-*r*74.0%
*-commutative74.0%
div-inv73.9%
associate-*r*73.8%
*-commutative73.8%
div-inv73.9%
sqrt-div99.4%
Applied egg-rr99.4%
associate-*r*99.4%
*-commutative99.4%
associate-*l*99.4%
Simplified99.4%
if 1e-59 < k Initial program 99.6%
add-sqr-sqrt99.5%
sqrt-unprod99.6%
*-commutative99.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
div-inv99.6%
*-commutative99.6%
Applied egg-rr99.6%
Simplified99.6%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 2.4e+60) (/ (sqrt (* PI (* n 2.0))) (sqrt k)) (sqrt (* 2.0 (+ -1.0 (fma n (/ PI k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 2.4e+60) {
tmp = sqrt((((double) M_PI) * (n * 2.0))) / sqrt(k);
} 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 <= 2.4e+60) tmp = Float64(sqrt(Float64(pi * Float64(n * 2.0))) / sqrt(k)); 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, 2.4e+60], N[(N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $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 2.4 \cdot 10^{+60}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(n \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 2.4e60Initial program 99.2%
add-sqr-sqrt98.8%
sqrt-unprod82.9%
*-commutative82.9%
associate-*r*82.9%
div-sub82.9%
metadata-eval82.9%
div-inv82.9%
*-commutative82.9%
Applied egg-rr82.8%
Simplified82.9%
Taylor expanded in k around 0 61.1%
associate-*r/61.1%
*-commutative61.1%
associate-*l*61.1%
Simplified61.1%
Taylor expanded in n around 0 61.1%
*-commutative61.1%
associate-*r/61.2%
Simplified61.2%
associate-*r*61.2%
*-commutative61.2%
div-inv61.1%
associate-*r*61.0%
*-commutative61.0%
div-inv61.1%
sqrt-div77.4%
Applied egg-rr77.4%
associate-*r*77.4%
*-commutative77.4%
associate-*l*77.4%
Simplified77.4%
if 2.4e60 < k Initial program 100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
*-commutative100.0%
associate-*r*100.0%
div-sub100.0%
metadata-eval100.0%
div-inv100.0%
*-commutative100.0%
Applied egg-rr100.0%
Simplified100.0%
Taylor expanded in k around 0 2.5%
associate-*r/2.5%
*-commutative2.5%
associate-*l*2.5%
Simplified2.5%
Taylor expanded in n around 0 2.5%
*-commutative2.5%
associate-*r/2.5%
Simplified2.5%
expm1-log1p-u2.5%
expm1-undefine27.1%
clear-num27.1%
div-inv27.1%
Applied egg-rr27.1%
sub-neg27.1%
metadata-eval27.1%
+-commutative27.1%
log1p-undefine27.1%
rem-exp-log27.1%
+-commutative27.1%
associate-/r/27.1%
*-commutative27.1%
fma-define27.1%
Simplified27.1%
Final simplification57.6%
(FPCore (k n) :precision binary64 (/ (pow (* 2.0 (* n PI)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((2.0 * (n * ((double) M_PI))), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((2.0 * (n * Math.PI)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((2.0 * (n * math.pi)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(2.0 * Float64(n * pi)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((2.0 * (n * pi)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(n * Pi), $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(n \cdot \pi\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%
Final simplification99.5%
(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.5%
add-sqr-sqrt99.3%
sqrt-unprod89.7%
*-commutative89.7%
associate-*r*89.7%
div-sub89.7%
metadata-eval89.7%
div-inv89.7%
*-commutative89.7%
Applied egg-rr89.6%
Simplified89.7%
Taylor expanded in k around 0 38.0%
associate-*r/38.0%
*-commutative38.0%
associate-*l*38.0%
Simplified38.0%
sqrt-prod47.9%
associate-*l/47.9%
Applied egg-rr47.9%
associate-/l*47.8%
Simplified47.8%
Final simplification47.8%
(FPCore (k n) :precision binary64 (* (sqrt (/ (* PI 2.0) k)) (sqrt n)))
double code(double k, double n) {
return sqrt(((((double) M_PI) * 2.0) / k)) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI * 2.0) / k)) * Math.sqrt(n);
}
def code(k, n): return math.sqrt(((math.pi * 2.0) / k)) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(Float64(pi * 2.0) / k)) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt(((pi * 2.0) / k)) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(N[(Pi * 2.0), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi \cdot 2}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod89.7%
*-commutative89.7%
associate-*r*89.7%
div-sub89.7%
metadata-eval89.7%
div-inv89.7%
*-commutative89.7%
Applied egg-rr89.6%
Simplified89.7%
Taylor expanded in k around 0 38.0%
associate-*r/38.0%
*-commutative38.0%
associate-*l*38.0%
Simplified38.0%
*-commutative38.0%
sqrt-prod47.9%
associate-*l/47.9%
Applied egg-rr47.9%
Final simplification47.9%
(FPCore (k n) :precision binary64 (/ (sqrt (* PI (* n 2.0))) (sqrt k)))
double code(double k, double n) {
return sqrt((((double) M_PI) * (n * 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (n * 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((math.pi * (n * 2.0))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(pi * Float64(n * 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((pi * (n * 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\pi \cdot \left(n \cdot 2\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod89.7%
*-commutative89.7%
associate-*r*89.7%
div-sub89.7%
metadata-eval89.7%
div-inv89.7%
*-commutative89.7%
Applied egg-rr89.6%
Simplified89.7%
Taylor expanded in k around 0 38.0%
associate-*r/38.0%
*-commutative38.0%
associate-*l*38.0%
Simplified38.0%
Taylor expanded in n around 0 38.0%
*-commutative38.0%
associate-*r/38.0%
Simplified38.0%
associate-*r*38.0%
*-commutative38.0%
div-inv38.0%
associate-*r*38.0%
*-commutative38.0%
div-inv38.0%
sqrt-div47.9%
Applied egg-rr47.9%
associate-*r*47.9%
*-commutative47.9%
associate-*l*47.9%
Simplified47.9%
Final simplification47.9%
(FPCore (k n) :precision binary64 (pow (* (/ k n) (/ 0.5 PI)) -0.5))
double code(double k, double n) {
return pow(((k / n) * (0.5 / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k / n) * (0.5 / Math.PI)), -0.5);
}
def code(k, n): return math.pow(((k / n) * (0.5 / math.pi)), -0.5)
function code(k, n) return Float64(Float64(k / n) * Float64(0.5 / pi)) ^ -0.5 end
function tmp = code(k, n) tmp = ((k / n) * (0.5 / pi)) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k / n), $MachinePrecision] * N[(0.5 / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{n} \cdot \frac{0.5}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod89.7%
*-commutative89.7%
associate-*r*89.7%
div-sub89.7%
metadata-eval89.7%
div-inv89.7%
*-commutative89.7%
Applied egg-rr89.6%
Simplified89.7%
Taylor expanded in k around 0 38.0%
associate-*r/38.0%
*-commutative38.0%
associate-*l*38.0%
Simplified38.0%
associate-*r*38.0%
associate-/l*38.0%
sqrt-unprod37.9%
clear-num37.9%
sqrt-div38.8%
metadata-eval38.8%
associate-/r/38.8%
frac-2neg38.8%
metadata-eval38.8%
div-inv38.8%
sqrt-undiv38.9%
div-inv38.9%
metadata-eval38.9%
Applied egg-rr38.9%
mul-1-neg38.9%
distribute-frac-neg238.9%
remove-double-neg38.9%
associate-/r*38.9%
Simplified38.9%
*-un-lft-identity38.9%
pow1/238.9%
pow-flip39.0%
*-commutative39.0%
associate-/l/38.9%
clear-num38.0%
associate-*r/38.0%
un-div-inv38.0%
clear-num38.0%
div-inv38.0%
metadata-eval38.0%
Applied egg-rr38.0%
*-lft-identity38.0%
associate-/r/38.9%
*-commutative38.9%
Simplified38.9%
Final simplification38.9%
(FPCore (k n) :precision binary64 (pow (* 0.5 (/ (/ k n) PI)) -0.5))
double code(double k, double n) {
return pow((0.5 * ((k / n) / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((0.5 * ((k / n) / Math.PI)), -0.5);
}
def code(k, n): return math.pow((0.5 * ((k / n) / math.pi)), -0.5)
function code(k, n) return Float64(0.5 * Float64(Float64(k / n) / pi)) ^ -0.5 end
function tmp = code(k, n) tmp = (0.5 * ((k / n) / pi)) ^ -0.5; end
code[k_, n_] := N[Power[N[(0.5 * N[(N[(k / n), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(0.5 \cdot \frac{\frac{k}{n}}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod89.7%
*-commutative89.7%
associate-*r*89.7%
div-sub89.7%
metadata-eval89.7%
div-inv89.7%
*-commutative89.7%
Applied egg-rr89.6%
Simplified89.7%
Taylor expanded in k around 0 38.0%
associate-*r/38.0%
*-commutative38.0%
associate-*l*38.0%
Simplified38.0%
associate-*r*38.0%
associate-/l*38.0%
sqrt-unprod37.9%
clear-num37.9%
sqrt-div38.8%
metadata-eval38.8%
associate-/r/38.8%
inv-pow38.8%
sqrt-undiv38.9%
sqrt-pow238.9%
div-inv38.9%
metadata-eval38.9%
metadata-eval38.9%
Applied egg-rr38.9%
associate-/r*39.0%
Simplified39.0%
Final simplification39.0%
(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%
add-sqr-sqrt99.3%
sqrt-unprod89.7%
*-commutative89.7%
associate-*r*89.7%
div-sub89.7%
metadata-eval89.7%
div-inv89.7%
*-commutative89.7%
Applied egg-rr89.6%
Simplified89.7%
Taylor expanded in k around 0 38.0%
associate-*r/38.0%
*-commutative38.0%
associate-*l*38.0%
Simplified38.0%
Taylor expanded in n around 0 38.0%
*-commutative38.0%
associate-*r/38.0%
Simplified38.0%
Final simplification38.0%
herbie shell --seed 2024075
(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))))