
(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 13 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))))))
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)));
}
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)));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return math.sqrt(t_0) / math.sqrt((k * math.pow(t_0, k)))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(sqrt(t_0) / sqrt(Float64(k * (t_0 ^ k)))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = sqrt(t_0) / sqrt((k * (t_0 ^ 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[Sqrt[N[(k * N[Power[t$95$0, k], $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}^{k}}}
\end{array}
\end{array}
Initial program 99.3%
associate-*l/99.4%
*-lft-identity99.4%
sqr-pow99.2%
pow-sqr99.4%
*-commutative99.4%
associate-*l*99.4%
associate-*r/99.4%
*-commutative99.4%
associate-/l*99.4%
metadata-eval99.4%
/-rgt-identity99.4%
div-sub99.4%
metadata-eval99.4%
Simplified99.4%
div-inv99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*l*99.3%
sub-neg99.3%
div-inv99.3%
metadata-eval99.3%
distribute-rgt-neg-in99.3%
metadata-eval99.3%
inv-pow99.3%
sqrt-pow299.4%
metadata-eval99.4%
Applied egg-rr99.4%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 8.6e+151) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (pow (pow (/ PI (/ k (/ n 0.5))) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 8.6e+151) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} else {
tmp = pow(pow((((double) M_PI) / (k / (n / 0.5))), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 8.6e+151) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} else {
tmp = Math.pow(Math.pow((Math.PI / (k / (n / 0.5))), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 8.6e+151: tmp = math.sqrt((2.0 * n)) / math.sqrt((k / math.pi)) else: tmp = math.pow(math.pow((math.pi / (k / (n / 0.5))), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 8.6e+151) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = (Float64(pi / Float64(k / Float64(n / 0.5))) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 8.6e+151) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); else tmp = ((pi / (k / (n / 0.5))) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 8.6e+151], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(Pi / N[(k / N[(n / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 8.6 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\frac{\pi}{\frac{k}{\frac{n}{0.5}}}\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 8.59999999999999965e151Initial program 99.1%
Taylor expanded in k around 0 67.4%
pow1/267.4%
pow-flip67.4%
metadata-eval67.4%
*-commutative67.4%
*-commutative67.4%
sqrt-prod67.6%
expm1-log1p-u63.4%
expm1-udef53.2%
Applied egg-rr32.4%
expm1-def42.7%
expm1-log1p44.7%
associate-/l*44.7%
associate-/r/44.7%
*-commutative44.7%
Simplified44.7%
Taylor expanded in k around 0 44.7%
associate-/l*44.7%
Simplified44.7%
associate-*r/44.7%
sqrt-div67.6%
Applied egg-rr67.6%
*-commutative67.6%
Simplified67.6%
if 8.59999999999999965e151 < k Initial program 100.0%
Taylor expanded in k around 0 2.8%
pow1/22.8%
pow-flip2.8%
metadata-eval2.8%
*-commutative2.8%
*-commutative2.8%
sqrt-prod2.8%
expm1-log1p-u2.8%
expm1-udef30.4%
Applied egg-rr30.4%
expm1-def2.7%
expm1-log1p2.7%
associate-/l*2.7%
associate-/r/2.7%
*-commutative2.7%
Simplified2.7%
associate-*l/2.7%
*-commutative2.7%
rem-cbrt-cube6.3%
unpow1/36.3%
sqr-pow6.3%
pow-prod-down19.2%
pow-prod-down19.2%
add-sqr-sqrt19.2%
*-commutative19.2%
associate-*r/19.2%
associate-*l*19.2%
metadata-eval19.2%
Applied egg-rr19.2%
associate-*r/19.2%
associate-*r/19.2%
/-rgt-identity19.2%
associate-*r*19.2%
associate-/l*19.2%
metadata-eval19.2%
associate-/r*19.2%
*-commutative19.2%
associate-/l*19.2%
associate-/l*19.2%
Simplified19.2%
Final simplification57.8%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.3%
associate-*l/99.4%
*-lft-identity99.4%
sqr-pow99.2%
pow-sqr99.4%
*-commutative99.4%
associate-*l*99.4%
associate-*r/99.4%
*-commutative99.4%
associate-/l*99.4%
metadata-eval99.4%
/-rgt-identity99.4%
div-sub99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.4%
(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.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
sqrt-prod54.4%
*-commutative54.4%
Applied egg-rr54.4%
Final simplification54.4%
(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.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in k around 0 36.2%
associate-/l*36.2%
Simplified36.2%
pow1/236.2%
*-commutative36.2%
clear-num36.2%
associate-/r/36.2%
clear-num36.2%
associate-*r*36.2%
metadata-eval36.2%
div-inv36.2%
unpow-prod-down54.4%
pow1/254.4%
clear-num54.4%
associate-/r/54.4%
metadata-eval54.4%
Applied egg-rr54.4%
unpow1/254.4%
*-commutative54.4%
Simplified54.4%
Final simplification54.4%
(FPCore (k n) :precision binary64 (/ (sqrt (* 2.0 (* PI n))) (sqrt k)))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) * n))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI * n))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((2.0 * (math.pi * n))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(2.0 * Float64(pi * n))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi * n))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 54.3%
associate-*l/54.3%
*-un-lft-identity54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.5%
Applied egg-rr54.5%
Final simplification54.5%
(FPCore (k n) :precision binary64 (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))))
double code(double k, double n) {
return sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
}
def code(k, n): return math.sqrt((2.0 * n)) / math.sqrt((k / math.pi))
function code(k, n) return Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))) end
function tmp = code(k, n) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in k around 0 36.2%
associate-/l*36.2%
Simplified36.2%
associate-*r/36.2%
sqrt-div54.5%
Applied egg-rr54.5%
*-commutative54.5%
Simplified54.5%
Final simplification54.5%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (* (/ k PI) (/ 0.5 n)))))
double code(double k, double n) {
return 1.0 / sqrt(((k / ((double) M_PI)) * (0.5 / n)));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt(((k / Math.PI) * (0.5 / n)));
}
def code(k, n): return 1.0 / math.sqrt(((k / math.pi) * (0.5 / n)))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(k / pi) * Float64(0.5 / n)))) end
function tmp = code(k, n) tmp = 1.0 / sqrt(((k / pi) * (0.5 / n))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(k / Pi), $MachinePrecision] * N[(0.5 / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{k}{\pi} \cdot \frac{0.5}{n}}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in k around 0 36.2%
associate-/l*36.2%
Simplified36.2%
associate-*r/36.2%
metadata-eval36.2%
associate-/r/36.2%
clear-num36.2%
associate-/r/36.2%
clear-num36.2%
associate-/r/36.2%
sqrt-div37.8%
metadata-eval37.8%
div-inv37.8%
clear-num37.8%
associate-/l*37.8%
Applied egg-rr37.8%
associate-/r/37.8%
Simplified37.8%
Final simplification37.8%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (* k 0.5) (* PI n)))))
double code(double k, double n) {
return 1.0 / sqrt(((k * 0.5) / (((double) M_PI) * n)));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt(((k * 0.5) / (Math.PI * n)));
}
def code(k, n): return 1.0 / math.sqrt(((k * 0.5) / (math.pi * n)))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(k * 0.5) / Float64(pi * n)))) end
function tmp = code(k, n) tmp = 1.0 / sqrt(((k * 0.5) / (pi * n))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(k * 0.5), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{k \cdot 0.5}{\pi \cdot n}}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
associate-*l/36.2%
*-commutative36.2%
clear-num36.2%
sqrt-div37.8%
metadata-eval37.8%
*-un-lft-identity37.8%
times-frac37.8%
metadata-eval37.8%
Applied egg-rr37.8%
associate-*r/37.8%
*-commutative37.8%
*-commutative37.8%
Simplified37.8%
Final simplification37.8%
(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.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in k around 0 36.2%
associate-/l*36.2%
Simplified36.2%
Final simplification36.2%
(FPCore (k n) :precision binary64 (sqrt (/ 2.0 (/ k (* PI n)))))
double code(double k, double n) {
return sqrt((2.0 / (k / (((double) M_PI) * n))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 / (k / (Math.PI * n))));
}
def code(k, n): return math.sqrt((2.0 / (k / (math.pi * n))))
function code(k, n) return sqrt(Float64(2.0 / Float64(k / Float64(pi * n)))) end
function tmp = code(k, n) tmp = sqrt((2.0 / (k / (pi * n)))); end
code[k_, n_] := N[Sqrt[N[(2.0 / N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{2}{\frac{k}{\pi \cdot n}}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
*-commutative36.2%
Simplified36.2%
Final simplification36.2%
(FPCore (k n) :precision binary64 (sqrt (/ PI (* k (/ 0.5 n)))))
double code(double k, double n) {
return sqrt((((double) M_PI) / (k * (0.5 / n))));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI / (k * (0.5 / n))));
}
def code(k, n): return math.sqrt((math.pi / (k * (0.5 / n))))
function code(k, n) return sqrt(Float64(pi / Float64(k * Float64(0.5 / n)))) end
function tmp = code(k, n) tmp = sqrt((pi / (k * (0.5 / n)))); end
code[k_, n_] := N[Sqrt[N[(Pi / N[(k * N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{k \cdot \frac{0.5}{n}}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in k around 0 36.2%
associate-/l*36.2%
Simplified36.2%
*-commutative36.2%
clear-num36.2%
associate-/r/36.2%
clear-num36.2%
associate-*r*36.2%
metadata-eval36.2%
div-inv36.2%
clear-num36.2%
un-div-inv36.2%
associate-/r*36.2%
Applied egg-rr36.2%
Final simplification36.2%
(FPCore (k n) :precision binary64 (sqrt (/ (* 2.0 PI) (/ k n))))
double code(double k, double n) {
return sqrt(((2.0 * ((double) M_PI)) / (k / n)));
}
public static double code(double k, double n) {
return Math.sqrt(((2.0 * Math.PI) / (k / n)));
}
def code(k, n): return math.sqrt(((2.0 * math.pi) / (k / n)))
function code(k, n) return sqrt(Float64(Float64(2.0 * pi) / Float64(k / n))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * pi) / (k / n))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * Pi), $MachinePrecision] / N[(k / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{2 \cdot \pi}{\frac{k}{n}}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 54.3%
pow1/254.3%
pow-flip54.3%
metadata-eval54.3%
*-commutative54.3%
*-commutative54.3%
sqrt-prod54.4%
expm1-log1p-u51.1%
expm1-udef48.5%
Applied egg-rr32.0%
expm1-def34.5%
expm1-log1p36.2%
associate-/l*36.2%
associate-/r/36.2%
*-commutative36.2%
Simplified36.2%
associate-*l/36.2%
*-commutative36.2%
associate-*r*36.2%
associate-/l*36.2%
Applied egg-rr36.2%
Final simplification36.2%
herbie shell --seed 2024020
(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))))