
(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 9 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 (* (pow k -0.5) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return pow(k, -0.5) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow(((2.0 * Math.PI) * n), ((1.0 - k) / 2.0));
}
def code(k, n): return math.pow(k, -0.5) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
function code(k, n) return Float64((k ^ -0.5) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Power[k, -0.5], $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}
\\
{k}^{-0.5} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.5%
expm1-log1p-u96.1%
expm1-udef75.8%
inv-pow75.8%
sqrt-pow275.8%
metadata-eval75.8%
Applied egg-rr75.8%
expm1-def96.1%
expm1-log1p99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 4.8e-47) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (sqrt (/ 1.0 (/ k (pow (* PI (* 2.0 n)) (- 1.0 k)))))))
double code(double k, double n) {
double tmp;
if (k <= 4.8e-47) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} else {
tmp = sqrt((1.0 / (k / pow((((double) M_PI) * (2.0 * n)), (1.0 - k)))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.8e-47) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} else {
tmp = Math.sqrt((1.0 / (k / Math.pow((Math.PI * (2.0 * n)), (1.0 - k)))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.8e-47: tmp = math.sqrt((2.0 * n)) / math.sqrt((k / math.pi)) else: tmp = math.sqrt((1.0 / (k / math.pow((math.pi * (2.0 * n)), (1.0 - k))))) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.8e-47) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = sqrt(Float64(1.0 / Float64(k / (Float64(pi * Float64(2.0 * n)) ^ Float64(1.0 - k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.8e-47) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); else tmp = sqrt((1.0 / (k / ((pi * (2.0 * n)) ^ (1.0 - k))))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.8e-47], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(1.0 / N[(k / N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.8 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{\frac{k}{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 4.7999999999999999e-47Initial program 99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
div-inv99.3%
expm1-log1p-u93.0%
expm1-udef76.4%
Applied egg-rr54.1%
expm1-def70.9%
expm1-log1p74.9%
associate-*r*74.9%
Simplified74.9%
Taylor expanded in k around 0 74.9%
associate-/l*74.8%
Simplified74.8%
associate-*r/74.8%
sqrt-div99.4%
Applied egg-rr99.4%
*-commutative99.4%
Simplified99.4%
if 4.7999999999999999e-47 < k Initial program 99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
div-inv99.8%
expm1-log1p-u99.5%
expm1-udef92.4%
Applied egg-rr92.4%
expm1-def99.5%
expm1-log1p99.8%
associate-*r*99.8%
Simplified99.8%
div-inv99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*l*99.8%
Applied egg-rr99.8%
div-inv99.8%
clear-num99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 5.5e-24) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (/ 1.0 (sqrt (/ k (pow (* PI (* 2.0 n)) (- 1.0 k)))))))
double code(double k, double n) {
double tmp;
if (k <= 5.5e-24) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} else {
tmp = 1.0 / sqrt((k / pow((((double) M_PI) * (2.0 * n)), (1.0 - k))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 5.5e-24) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} else {
tmp = 1.0 / Math.sqrt((k / Math.pow((Math.PI * (2.0 * n)), (1.0 - k))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 5.5e-24: tmp = math.sqrt((2.0 * n)) / math.sqrt((k / math.pi)) else: tmp = 1.0 / math.sqrt((k / math.pow((math.pi * (2.0 * n)), (1.0 - k)))) return tmp
function code(k, n) tmp = 0.0 if (k <= 5.5e-24) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = Float64(1.0 / sqrt(Float64(k / (Float64(pi * Float64(2.0 * n)) ^ Float64(1.0 - k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 5.5e-24) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); else tmp = 1.0 / sqrt((k / ((pi * (2.0 * n)) ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 5.5e-24], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k / N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 5.4999999999999999e-24Initial program 99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
div-inv99.3%
expm1-log1p-u93.2%
expm1-udef73.2%
Applied egg-rr52.8%
expm1-def73.0%
expm1-log1p76.9%
associate-*r*76.9%
Simplified76.9%
Taylor expanded in k around 0 76.9%
associate-/l*76.9%
Simplified76.9%
associate-*r/76.9%
sqrt-div99.4%
Applied egg-rr99.4%
*-commutative99.4%
Simplified99.4%
if 5.4999999999999999e-24 < k Initial program 99.8%
expm1-log1p-u99.7%
expm1-udef61.5%
inv-pow61.5%
sqrt-pow261.5%
metadata-eval61.5%
Applied egg-rr61.5%
expm1-def99.7%
expm1-log1p99.8%
Simplified99.8%
metadata-eval99.8%
pow-flip99.8%
pow1/299.8%
associate-*r*99.8%
add-exp-log99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
add-exp-log99.8%
associate-*r*99.8%
add-sqr-sqrt99.8%
sqrt-prod99.8%
sqr-pow99.8%
Applied egg-rr99.8%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 2e-24) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (sqrt (/ (pow (* (* 2.0 PI) n) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 2e-24) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} 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 <= 2e-24) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} 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 <= 2e-24: tmp = math.sqrt((2.0 * n)) / math.sqrt((k / math.pi)) 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 <= 2e-24) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = sqrt(Float64((Float64(Float64(2.0 * pi) * n) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2e-24) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); else tmp = sqrt(((((2.0 * pi) * n) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2e-24], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 1.99999999999999985e-24Initial program 99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
div-inv99.3%
expm1-log1p-u93.2%
expm1-udef73.2%
Applied egg-rr52.8%
expm1-def73.0%
expm1-log1p76.9%
associate-*r*76.9%
Simplified76.9%
Taylor expanded in k around 0 76.9%
associate-/l*76.9%
Simplified76.9%
associate-*r/76.9%
sqrt-div99.4%
Applied egg-rr99.4%
*-commutative99.4%
Simplified99.4%
if 1.99999999999999985e-24 < k Initial program 99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
div-inv99.8%
expm1-log1p-u99.7%
expm1-udef96.3%
Applied egg-rr96.3%
expm1-def99.8%
expm1-log1p99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (/ (- 1.0 k) 2.0)) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), ((1.0 - k) / 2.0)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), ((1.0 - k) / 2.0)) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), ((1.0 - k) / 2.0)) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(Float64(1.0 - k) / 2.0)) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ ((1.0 - k) / 2.0)) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 2.1e+232) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (cbrt (pow (* 2.0 (/ PI (/ k n))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 2.1e+232) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) / (k / n))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.1e+232) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI / (k / n))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 2.1e+232) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = cbrt((Float64(2.0 * Float64(pi / Float64(k / n))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 2.1e+232], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi / N[(k / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.1 \cdot 10^{+232}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \frac{\pi}{\frac{k}{n}}\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 2.09999999999999991e232Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.5%
expm1-log1p-u96.2%
expm1-udef83.5%
Applied egg-rr72.6%
expm1-def85.4%
expm1-log1p87.6%
associate-*r*87.6%
Simplified87.6%
Taylor expanded in k around 0 44.7%
associate-/l*44.7%
Simplified44.7%
associate-*r/44.7%
sqrt-div56.7%
Applied egg-rr56.7%
*-commutative56.7%
Simplified56.7%
if 2.09999999999999991e232 < k Initial program 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
div-inv100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in k around 0 3.1%
associate-/l*3.1%
associate-/r/3.1%
Simplified3.1%
add-cbrt-cube27.8%
pow1/327.8%
add-sqr-sqrt27.8%
pow127.8%
pow1/227.8%
pow-prod-up27.8%
*-commutative27.8%
metadata-eval27.8%
Applied egg-rr27.8%
unpow1/327.8%
associate-*r/27.8%
associate-/l*27.8%
Simplified27.8%
Final simplification53.2%
(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.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u96.7%
expm1-udef85.5%
Applied egg-rr75.9%
expm1-def87.2%
expm1-log1p89.1%
associate-*r*89.1%
Simplified89.1%
Taylor expanded in k around 0 39.7%
associate-/l*39.7%
Simplified39.7%
associate-*r/39.7%
sqrt-div50.2%
Applied egg-rr50.2%
*-commutative50.2%
Simplified50.2%
Final simplification50.2%
(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%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u96.7%
expm1-udef85.5%
Applied egg-rr75.9%
expm1-def87.2%
expm1-log1p89.1%
associate-*r*89.1%
Simplified89.1%
Taylor expanded in k around 0 39.7%
associate-/l*39.7%
associate-/r/39.7%
Simplified39.7%
Final simplification39.7%
(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(Float64(pi * 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[(N[(Pi * n), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi \cdot n}{k}}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u96.7%
expm1-udef85.5%
Applied egg-rr75.9%
expm1-def87.2%
expm1-log1p89.1%
associate-*r*89.1%
Simplified89.1%
Taylor expanded in k around 0 39.7%
Final simplification39.7%
herbie shell --seed 2023182
(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))))