
(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 12 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 2.0) PI))) (/ (pow k -0.5) (pow (/ t_0 (pow t_0 k)) -0.5))))
double code(double k, double n) {
double t_0 = (n * 2.0) * ((double) M_PI);
return pow(k, -0.5) / pow((t_0 / pow(t_0, k)), -0.5);
}
public static double code(double k, double n) {
double t_0 = (n * 2.0) * Math.PI;
return Math.pow(k, -0.5) / Math.pow((t_0 / Math.pow(t_0, k)), -0.5);
}
def code(k, n): t_0 = (n * 2.0) * math.pi return math.pow(k, -0.5) / math.pow((t_0 / math.pow(t_0, k)), -0.5)
function code(k, n) t_0 = Float64(Float64(n * 2.0) * pi) return Float64((k ^ -0.5) / (Float64(t_0 / (t_0 ^ k)) ^ -0.5)) end
function tmp = code(k, n) t_0 = (n * 2.0) * pi; tmp = (k ^ -0.5) / ((t_0 / (t_0 ^ k)) ^ -0.5); end
code[k_, n_] := Block[{t$95$0 = N[(N[(n * 2.0), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Power[k, -0.5], $MachinePrecision] / N[Power[N[(t$95$0 / N[Power[t$95$0, k], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(n \cdot 2\right) \cdot \pi\\
\frac{{k}^{-0.5}}{{\left(\frac{t_0}{{t_0}^{k}}\right)}^{-0.5}}
\end{array}
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*r*99.4%
associate-/r/99.5%
add-sqr-sqrt99.3%
sqrt-unprod99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r*99.5%
*-commutative99.5%
pow-prod-up99.5%
Applied egg-rr99.5%
inv-pow99.5%
div-inv99.5%
unpow-prod-down99.4%
inv-pow99.4%
pow1/299.4%
pow-flip99.4%
metadata-eval99.4%
Applied egg-rr99.4%
unpow-199.4%
associate-*r/99.4%
*-commutative99.4%
*-lft-identity99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
Simplified99.4%
pow-sub99.6%
pow199.6%
associate-*r*99.6%
associate-*r*99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 2.15e-60) (* (pow k -0.5) (pow (/ (/ 0.5 n) PI) -0.5)) (sqrt (/ (pow (* 2.0 (* n PI)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 2.15e-60) {
tmp = pow(k, -0.5) * pow(((0.5 / n) / ((double) M_PI)), -0.5);
} else {
tmp = sqrt((pow((2.0 * (n * ((double) M_PI))), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.15e-60) {
tmp = Math.pow(k, -0.5) * Math.pow(((0.5 / n) / Math.PI), -0.5);
} else {
tmp = Math.sqrt((Math.pow((2.0 * (n * Math.PI)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2.15e-60: tmp = math.pow(k, -0.5) * math.pow(((0.5 / n) / math.pi), -0.5) else: tmp = math.sqrt((math.pow((2.0 * (n * math.pi)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 2.15e-60) tmp = Float64((k ^ -0.5) * (Float64(Float64(0.5 / n) / pi) ^ -0.5)); else tmp = sqrt(Float64((Float64(2.0 * Float64(n * pi)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.15e-60) tmp = (k ^ -0.5) * (((0.5 / n) / pi) ^ -0.5); else tmp = sqrt((((2.0 * (n * pi)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.15e-60], N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(N[(0.5 / n), $MachinePrecision] / Pi), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(2.0 * N[(n * Pi), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.15 \cdot 10^{-60}:\\
\;\;\;\;{k}^{-0.5} \cdot {\left(\frac{\frac{0.5}{n}}{\pi}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(2 \cdot \left(n \cdot \pi\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 2.15e-60Initial program 99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
div-inv99.4%
add-sqr-sqrt99.0%
sqrt-unprod70.2%
frac-times70.2%
Applied egg-rr70.5%
Taylor expanded in k around 0 70.5%
*-commutative70.5%
associate-*l*70.5%
Simplified70.5%
Taylor expanded in n around 0 70.5%
associate-*r/70.5%
associate-/l*70.4%
associate-/r/70.4%
Simplified70.4%
associate-*l/70.5%
clear-num70.4%
unpow-170.4%
sqrt-pow171.3%
div-inv71.2%
metadata-eval71.2%
unpow-prod-down99.4%
associate-*r*99.4%
Applied egg-rr99.4%
associate-/r*99.4%
associate-/r*99.4%
metadata-eval99.4%
Simplified99.4%
if 2.15e-60 < k Initial program 99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
div-inv99.6%
add-sqr-sqrt99.5%
sqrt-unprod99.6%
frac-times99.6%
Applied egg-rr99.7%
Final simplification99.5%
(FPCore (k n) :precision binary64 (/ (pow (* (* n 2.0) PI) (/ (- 1.0 k) 2.0)) (sqrt k)))
double code(double k, double n) {
return pow(((n * 2.0) * ((double) M_PI)), ((1.0 - k) / 2.0)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow(((n * 2.0) * Math.PI), ((1.0 - k) / 2.0)) / Math.sqrt(k);
}
def code(k, n): return math.pow(((n * 2.0) * math.pi), ((1.0 - k) / 2.0)) / math.sqrt(k)
function code(k, n) return Float64((Float64(Float64(n * 2.0) * pi) ^ Float64(Float64(1.0 - k) / 2.0)) / sqrt(k)) end
function tmp = code(k, n) tmp = (((n * 2.0) * pi) ^ ((1.0 - k) / 2.0)) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(N[(n * 2.0), $MachinePrecision] * Pi), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\left(n \cdot 2\right) \cdot \pi\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
associate-*l/99.5%
*-lft-identity99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 1.15e+122) (/ (sqrt (* (* n 2.0) PI)) (sqrt k)) (pow (pow (* 2.0 (/ n (/ k PI))) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 1.15e+122) {
tmp = sqrt(((n * 2.0) * ((double) M_PI))) / sqrt(k);
} else {
tmp = pow(pow((2.0 * (n / (k / ((double) M_PI)))), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.15e+122) {
tmp = Math.sqrt(((n * 2.0) * Math.PI)) / Math.sqrt(k);
} else {
tmp = Math.pow(Math.pow((2.0 * (n / (k / Math.PI))), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.15e+122: tmp = math.sqrt(((n * 2.0) * math.pi)) / math.sqrt(k) else: tmp = math.pow(math.pow((2.0 * (n / (k / math.pi))), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.15e+122) tmp = Float64(sqrt(Float64(Float64(n * 2.0) * pi)) / sqrt(k)); else tmp = (Float64(2.0 * Float64(n / Float64(k / pi))) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.15e+122) tmp = sqrt(((n * 2.0) * pi)) / sqrt(k); else tmp = ((2.0 * (n / (k / pi))) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.15e+122], N[(N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(n / N[(k / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.15 \cdot 10^{+122}:\\
\;\;\;\;\frac{\sqrt{\left(n \cdot 2\right) \cdot \pi}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(2 \cdot \frac{n}{\frac{k}{\pi}}\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 1.15e122Initial program 99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
div-inv99.4%
add-sqr-sqrt99.1%
sqrt-unprod83.0%
frac-times83.0%
Applied egg-rr83.2%
Taylor expanded in k around 0 54.2%
*-commutative54.2%
associate-*l*54.2%
Simplified54.2%
sqrt-div70.4%
associate-*r*70.4%
*-commutative70.4%
Applied egg-rr70.4%
associate-*r*70.4%
*-commutative70.4%
Simplified70.4%
if 1.15e122 < k Initial program 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
div-inv100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
frac-times100.0%
Applied egg-rr100.0%
Taylor expanded in k around 0 2.8%
*-commutative2.8%
associate-*l*2.8%
Simplified2.8%
Taylor expanded in n around 0 2.8%
associate-*r/2.8%
associate-/l*2.7%
associate-/r/2.8%
Simplified2.8%
pow1/22.8%
associate-*l/2.8%
metadata-eval2.8%
pow-pow8.4%
sqr-pow8.4%
pow-prod-down25.6%
pow-prod-up25.6%
*-un-lft-identity25.6%
times-frac25.6%
metadata-eval25.6%
metadata-eval25.6%
metadata-eval25.6%
Applied egg-rr25.6%
associate-/l*25.6%
Simplified25.6%
Final simplification58.6%
(FPCore (k n) :precision binary64 (* (sqrt (/ 2.0 k)) (sqrt (* n PI))))
double code(double k, double n) {
return sqrt((2.0 / k)) * sqrt((n * ((double) M_PI)));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 / k)) * Math.sqrt((n * Math.PI));
}
def code(k, n): return math.sqrt((2.0 / k)) * math.sqrt((n * math.pi))
function code(k, n) return Float64(sqrt(Float64(2.0 / k)) * sqrt(Float64(n * pi))) end
function tmp = code(k, n) tmp = sqrt((2.0 / k)) * sqrt((n * pi)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(n * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{2}{k}} \cdot \sqrt{n \cdot \pi}
\end{array}
Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
Taylor expanded in n around 0 40.7%
associate-*r/40.7%
associate-/l*40.7%
associate-/r/40.7%
Simplified40.7%
sqrt-prod52.7%
Applied egg-rr52.7%
Final simplification52.7%
(FPCore (k n) :precision binary64 (/ (sqrt (* (* n 2.0) PI)) (sqrt k)))
double code(double k, double n) {
return sqrt(((n * 2.0) * ((double) M_PI))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt(((n * 2.0) * Math.PI)) / Math.sqrt(k);
}
def code(k, n): return math.sqrt(((n * 2.0) * math.pi)) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(Float64(n * 2.0) * pi)) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt(((n * 2.0) * pi)) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\left(n \cdot 2\right) \cdot \pi}}{\sqrt{k}}
\end{array}
Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
sqrt-div52.7%
associate-*r*52.7%
*-commutative52.7%
Applied egg-rr52.7%
associate-*r*52.7%
*-commutative52.7%
Simplified52.7%
Final simplification52.7%
(FPCore (k n) :precision binary64 (pow (* k (/ (/ 0.5 n) PI)) -0.5))
double code(double k, double n) {
return pow((k * ((0.5 / n) / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k * ((0.5 / n) / Math.PI)), -0.5);
}
def code(k, n): return math.pow((k * ((0.5 / n) / math.pi)), -0.5)
function code(k, n) return Float64(k * Float64(Float64(0.5 / n) / pi)) ^ -0.5 end
function tmp = code(k, n) tmp = (k * ((0.5 / n) / pi)) ^ -0.5; end
code[k_, n_] := N[Power[N[(k * N[(N[(0.5 / n), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{\frac{0.5}{n}}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
Taylor expanded in n around 0 40.7%
associate-*r/40.7%
associate-/l*40.7%
associate-/r/40.7%
Simplified40.7%
associate-*l/40.7%
clear-num40.7%
unpow-140.7%
sqrt-pow141.1%
associate-*r*41.1%
metadata-eval41.1%
Applied egg-rr41.1%
*-rgt-identity41.1%
associate-*r/41.0%
associate-/r*41.0%
associate-/r*41.0%
metadata-eval41.0%
Simplified41.0%
Final simplification41.0%
(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(Float64(n * 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), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{\left(n \cdot 2\right) \cdot \pi}\right)}^{-0.5}
\end{array}
Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
Taylor expanded in n around 0 40.7%
associate-*r/40.7%
associate-/l*40.7%
associate-/r/40.7%
Simplified40.7%
associate-*l/40.7%
clear-num40.7%
unpow-140.7%
sqrt-pow141.1%
associate-*r*41.1%
metadata-eval41.1%
Applied egg-rr41.1%
Final simplification41.1%
(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.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
Taylor expanded in n around 0 40.7%
associate-*r/40.7%
associate-/l*40.7%
associate-/r/40.7%
Simplified40.7%
Taylor expanded in k around 0 40.7%
associate-/l*40.7%
Simplified40.7%
Final simplification40.7%
(FPCore (k n) :precision binary64 (sqrt (* PI (* n (/ 2.0 k)))))
double code(double k, double n) {
return sqrt((((double) M_PI) * (n * (2.0 / k))));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (n * (2.0 / k))));
}
def code(k, n): return math.sqrt((math.pi * (n * (2.0 / k))))
function code(k, n) return sqrt(Float64(pi * Float64(n * Float64(2.0 / k)))) end
function tmp = code(k, n) tmp = sqrt((pi * (n * (2.0 / k)))); end
code[k_, n_] := N[Sqrt[N[(Pi * N[(n * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \left(n \cdot \frac{2}{k}\right)}
\end{array}
Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
clear-num40.7%
inv-pow40.7%
associate-*r*40.7%
*-commutative40.7%
Applied egg-rr40.7%
unpow-140.7%
clear-num40.7%
associate-*l/40.7%
associate-*r*40.7%
Applied egg-rr40.7%
Final simplification40.7%
(FPCore (k n) :precision binary64 (sqrt (/ 2.0 (/ k (* n PI)))))
double code(double k, double n) {
return sqrt((2.0 / (k / (n * ((double) M_PI)))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 / (k / (n * Math.PI))));
}
def code(k, n): return math.sqrt((2.0 / (k / (n * math.pi))))
function code(k, n) return sqrt(Float64(2.0 / Float64(k / Float64(n * pi)))) end
function tmp = code(k, n) tmp = sqrt((2.0 / (k / (n * pi)))); end
code[k_, n_] := N[Sqrt[N[(2.0 / N[(k / N[(n * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{2}{\frac{k}{n \cdot \pi}}}
\end{array}
Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
Taylor expanded in n around 0 40.7%
associate-*r/40.7%
associate-/l*40.7%
associate-/r/40.7%
Simplified40.7%
associate-*l/40.7%
associate-/l*40.7%
Applied egg-rr40.7%
Final simplification40.7%
(FPCore (k n) :precision binary64 (sqrt (/ (* n (* 2.0 PI)) k)))
double code(double k, double n) {
return sqrt(((n * (2.0 * ((double) M_PI))) / k));
}
public static double code(double k, double n) {
return Math.sqrt(((n * (2.0 * Math.PI)) / k));
}
def code(k, n): return math.sqrt(((n * (2.0 * math.pi)) / k))
function code(k, n) return sqrt(Float64(Float64(n * Float64(2.0 * pi)) / k)) end
function tmp = code(k, n) tmp = sqrt(((n * (2.0 * pi)) / k)); end
code[k_, n_] := N[Sqrt[N[(N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n \cdot \left(2 \cdot \pi\right)}{k}}
\end{array}
Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.4%
frac-times87.4%
Applied egg-rr87.6%
Taylor expanded in k around 0 40.7%
*-commutative40.7%
associate-*l*40.7%
Simplified40.7%
Final simplification40.7%
herbie shell --seed 2023187
(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))))