
(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)))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI * n);
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); 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[Sqrt[k], $MachinePrecision] * N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\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.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%
(FPCore (k n) :precision binary64 (if (<= k 5.2e-74) (/ (sqrt (* PI (* 2.0 n))) (sqrt k)) (sqrt (/ (pow (* 2.0 (* PI n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 5.2e-74) {
tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(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 <= 5.2e-74) {
tmp = Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(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 <= 5.2e-74: tmp = math.sqrt((math.pi * (2.0 * n))) / math.sqrt(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 <= 5.2e-74) tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(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 <= 5.2e-74) tmp = sqrt((pi * (2.0 * n))) / sqrt(k); else tmp = sqrt((((2.0 * (pi * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 5.2e-74], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $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 5.2 \cdot 10^{-74}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{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 < 5.2000000000000002e-74Initial program 99.3%
Taylor expanded in k around 0 72.7%
associate-/l*72.7%
Simplified72.7%
pow172.7%
sqrt-unprod72.8%
Applied egg-rr72.8%
unpow172.8%
*-commutative72.8%
associate-*r/72.9%
Simplified72.9%
associate-*r/72.9%
sqrt-div99.5%
*-commutative99.5%
associate-*r*99.5%
*-commutative99.5%
*-commutative99.5%
Applied egg-rr99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r*99.5%
Simplified99.5%
if 5.2000000000000002e-74 < k Initial program 99.7%
Applied egg-rr99.8%
distribute-lft-in99.8%
metadata-eval99.8%
*-commutative99.8%
associate-*r*99.8%
metadata-eval99.8%
neg-mul-199.8%
sub-neg99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 3e+191) (/ (sqrt (* PI (* 2.0 n))) (sqrt k)) (pow (* (pow (/ n (/ k PI)) 2.0) 4.0) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 3e+191) {
tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
} else {
tmp = pow((pow((n / (k / ((double) M_PI))), 2.0) * 4.0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3e+191) {
tmp = Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
} else {
tmp = Math.pow((Math.pow((n / (k / Math.PI)), 2.0) * 4.0), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 3e+191: tmp = math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k) else: tmp = math.pow((math.pow((n / (k / math.pi)), 2.0) * 4.0), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 3e+191) tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k)); else tmp = Float64((Float64(n / Float64(k / pi)) ^ 2.0) * 4.0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 3e+191) tmp = sqrt((pi * (2.0 * n))) / sqrt(k); else tmp = (((n / (k / pi)) ^ 2.0) * 4.0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 3e+191], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[N[(n / N[(k / Pi), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 4.0), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{+191}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\frac{n}{\frac{k}{\pi}}\right)}^{2} \cdot 4\right)}^{0.25}\\
\end{array}
\end{array}
if k < 2.9999999999999997e191Initial program 99.5%
Taylor expanded in k around 0 45.6%
associate-/l*45.6%
Simplified45.6%
pow145.6%
sqrt-unprod45.7%
Applied egg-rr45.7%
unpow145.7%
*-commutative45.7%
associate-*r/45.8%
Simplified45.8%
associate-*r/45.8%
sqrt-div57.0%
*-commutative57.0%
associate-*r*57.0%
*-commutative57.0%
*-commutative57.0%
Applied egg-rr57.0%
associate-*r*57.0%
*-commutative57.0%
associate-*r*57.0%
Simplified57.0%
if 2.9999999999999997e191 < k Initial program 100.0%
Taylor expanded in k around 0 2.5%
associate-/l*2.5%
Simplified2.5%
sqrt-unprod2.5%
Applied egg-rr2.5%
*-commutative2.5%
metadata-eval2.5%
associate-*r/2.5%
times-frac2.5%
associate-*r*2.5%
*-un-lft-identity2.5%
pow1/22.5%
*-commutative2.5%
associate-*r*2.5%
associate-*r/2.5%
metadata-eval2.5%
pow-sqr2.5%
pow-prod-down14.1%
Applied egg-rr14.1%
Final simplification50.1%
(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.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
(FPCore (k n) :precision binary64 (/ (sqrt (* PI (* 2.0 n))) (sqrt k)))
double code(double k, double n) {
return sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((pi * (2.0 * n))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 38.7%
associate-/l*38.7%
Simplified38.7%
pow138.7%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
*-commutative38.8%
associate-*r/38.8%
Simplified38.8%
associate-*r/38.8%
sqrt-div48.3%
*-commutative48.3%
associate-*r*48.3%
*-commutative48.3%
*-commutative48.3%
Applied egg-rr48.3%
associate-*r*48.3%
*-commutative48.3%
associate-*r*48.3%
Simplified48.3%
Final simplification48.3%
(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.5%
Taylor expanded in k around 0 38.7%
associate-/l*38.7%
Simplified38.7%
sqrt-unprod38.8%
Applied egg-rr38.8%
*-commutative38.8%
metadata-eval38.8%
associate-*r/38.8%
times-frac38.8%
associate-*r*38.8%
*-un-lft-identity38.8%
sqrt-undiv48.3%
sqrt-prod48.2%
*-un-lft-identity48.2%
times-frac48.1%
sqrt-div48.3%
Applied egg-rr48.3%
/-rgt-identity48.3%
*-commutative48.3%
Simplified48.3%
Final simplification48.3%
(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%
Taylor expanded in k around 0 38.7%
associate-/l*38.7%
Simplified38.7%
sqrt-unprod38.8%
Applied egg-rr38.8%
pow1/238.8%
associate-*l*38.8%
unpow-prod-down48.2%
pow1/248.2%
Applied egg-rr48.2%
unpow1/248.2%
associate-*l/48.2%
associate-/l*48.2%
Simplified48.2%
(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(Float64(0.5 * 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[(N[(0.5 * N[(k / n), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{0.5 \cdot \frac{k}{n}}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 38.7%
associate-/l*38.7%
Simplified38.7%
pow138.7%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
*-commutative38.8%
associate-*r/38.8%
Simplified38.8%
clear-num38.8%
un-div-inv38.8%
sqrt-undiv38.9%
clear-num38.9%
inv-pow38.9%
sqrt-undiv38.9%
sqrt-pow239.0%
div-inv39.0%
metadata-eval39.0%
metadata-eval39.0%
Applied egg-rr39.0%
*-commutative39.0%
associate-/r*39.0%
associate-*r/39.0%
Simplified39.0%
(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.5%
Taylor expanded in k around 0 38.7%
associate-/l*38.7%
Simplified38.7%
pow138.7%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
*-commutative38.8%
associate-*r/38.8%
Simplified38.8%
clear-num38.8%
un-div-inv38.8%
sqrt-undiv38.9%
clear-num38.9%
frac-2neg38.9%
metadata-eval38.9%
div-inv38.9%
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%
*-commutative38.9%
associate-/r*38.9%
associate-*r/38.9%
Simplified38.9%
inv-pow38.9%
sqrt-pow239.0%
clear-num38.8%
un-div-inv38.8%
metadata-eval38.8%
Applied egg-rr38.8%
associate-/r/39.0%
associate-*l/39.0%
associate-/r*39.0%
*-commutative39.0%
associate-/l*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(Float64(2.0 * pi) * Float64(n / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * pi) * (n / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * Pi), $MachinePrecision] * N[(n / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot \pi\right) \cdot \frac{n}{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 38.7%
associate-/l*38.7%
Simplified38.7%
associate-*r/38.7%
*-commutative38.7%
Applied egg-rr38.7%
sqrt-unprod38.8%
*-commutative38.8%
*-commutative38.8%
*-commutative38.8%
associate-/l*38.9%
associate-*r*38.9%
*-commutative38.9%
Applied egg-rr38.9%
Final simplification38.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.5%
Taylor expanded in k around 0 38.7%
associate-/l*38.7%
Simplified38.7%
pow138.7%
sqrt-unprod38.8%
Applied egg-rr38.8%
unpow138.8%
*-commutative38.8%
associate-*r/38.8%
Simplified38.8%
associate-*r/38.8%
sqrt-div48.3%
*-commutative48.3%
associate-*r*48.3%
*-commutative48.3%
*-commutative48.3%
Applied egg-rr48.3%
associate-*r*48.3%
*-commutative48.3%
associate-*r*48.3%
Simplified48.3%
sqrt-undiv38.8%
associate-*r*38.8%
*-un-lft-identity38.8%
times-frac38.8%
metadata-eval38.8%
associate-*r/38.8%
clear-num38.8%
un-div-inv38.8%
Applied egg-rr38.8%
herbie shell --seed 2024152
(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))))