
(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 (* 2.0 PI)))) (* (sqrt t_0) (* (pow t_0 (* k -0.5)) (pow k -0.5)))))
double code(double k, double n) {
double t_0 = n * (2.0 * ((double) M_PI));
return sqrt(t_0) * (pow(t_0, (k * -0.5)) * pow(k, -0.5));
}
public static double code(double k, double n) {
double t_0 = n * (2.0 * Math.PI);
return Math.sqrt(t_0) * (Math.pow(t_0, (k * -0.5)) * Math.pow(k, -0.5));
}
def code(k, n): t_0 = n * (2.0 * math.pi) return math.sqrt(t_0) * (math.pow(t_0, (k * -0.5)) * math.pow(k, -0.5))
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) return Float64(sqrt(t_0) * Float64((t_0 ^ Float64(k * -0.5)) * (k ^ -0.5))) end
function tmp = code(k, n) t_0 = n * (2.0 * pi); tmp = sqrt(t_0) * ((t_0 ^ (k * -0.5)) * (k ^ -0.5)); end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(N[Power[t$95$0, N[(k * -0.5), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\sqrt{t\_0} \cdot \left({t\_0}^{\left(k \cdot -0.5\right)} \cdot {k}^{-0.5}\right)
\end{array}
\end{array}
Initial program 99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-sub99.7%
pow1/299.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
*-un-lft-identity99.7%
inv-pow99.7%
sqrt-pow299.7%
metadata-eval99.7%
Applied egg-rr99.7%
*-lft-identity99.7%
Simplified99.7%
*-commutative99.7%
div-inv99.7%
associate-*l*99.7%
*-commutative99.7%
*-commutative99.7%
associate-*l*99.7%
pow-flip99.7%
*-commutative99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Applied egg-rr99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* n 2.0)))) (/ (* (pow t_0 (* k -0.5)) (sqrt t_0)) (sqrt k))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (n * 2.0);
return (pow(t_0, (k * -0.5)) * sqrt(t_0)) / sqrt(k);
}
public static double code(double k, double n) {
double t_0 = Math.PI * (n * 2.0);
return (Math.pow(t_0, (k * -0.5)) * Math.sqrt(t_0)) / Math.sqrt(k);
}
def code(k, n): t_0 = math.pi * (n * 2.0) return (math.pow(t_0, (k * -0.5)) * math.sqrt(t_0)) / math.sqrt(k)
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) return Float64(Float64((t_0 ^ Float64(k * -0.5)) * sqrt(t_0)) / sqrt(k)) end
function tmp = code(k, n) t_0 = pi * (n * 2.0); tmp = ((t_0 ^ (k * -0.5)) * sqrt(t_0)) / sqrt(k); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[t$95$0, N[(k * -0.5), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(n \cdot 2\right)\\
\frac{{t\_0}^{\left(k \cdot -0.5\right)} \cdot \sqrt{t\_0}}{\sqrt{k}}
\end{array}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
sub-neg99.5%
distribute-frac-neg99.5%
+-commutative99.5%
neg-mul-199.5%
*-commutative99.5%
associate-/l*99.5%
fma-define99.5%
metadata-eval99.5%
metadata-eval99.5%
Simplified99.5%
fma-undefine99.5%
unpow-prod-up99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
pow1/299.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* n (* 2.0 PI))))
(if (<= k 2.75e-44)
(* (sqrt t_0) (sqrt (/ 1.0 k)))
(sqrt (/ (pow t_0 (- 1.0 k)) k)))))
double code(double k, double n) {
double t_0 = n * (2.0 * ((double) M_PI));
double tmp;
if (k <= 2.75e-44) {
tmp = sqrt(t_0) * sqrt((1.0 / k));
} else {
tmp = sqrt((pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = n * (2.0 * Math.PI);
double tmp;
if (k <= 2.75e-44) {
tmp = Math.sqrt(t_0) * Math.sqrt((1.0 / k));
} else {
tmp = Math.sqrt((Math.pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): t_0 = n * (2.0 * math.pi) tmp = 0 if k <= 2.75e-44: tmp = math.sqrt(t_0) * math.sqrt((1.0 / k)) else: tmp = math.sqrt((math.pow(t_0, (1.0 - k)) / k)) return tmp
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) tmp = 0.0 if (k <= 2.75e-44) tmp = Float64(sqrt(t_0) * sqrt(Float64(1.0 / k))); else tmp = sqrt(Float64((t_0 ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) t_0 = n * (2.0 * pi); tmp = 0.0; if (k <= 2.75e-44) tmp = sqrt(t_0) * sqrt((1.0 / k)); else tmp = sqrt(((t_0 ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2.75e-44], N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[t$95$0, N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\mathbf{if}\;k \leq 2.75 \cdot 10^{-44}:\\
\;\;\;\;\sqrt{t\_0} \cdot \sqrt{\frac{1}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t\_0}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 2.74999999999999996e-44Initial program 99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
pow-sub99.4%
pow1/299.4%
associate-*r*99.4%
*-commutative99.4%
associate-*l*99.4%
associate-*r*99.4%
*-commutative99.4%
associate-*l*99.4%
div-inv99.4%
metadata-eval99.4%
Applied egg-rr99.4%
*-un-lft-identity99.4%
inv-pow99.4%
sqrt-pow299.5%
metadata-eval99.5%
Applied egg-rr99.5%
*-lft-identity99.5%
Simplified99.5%
*-commutative99.5%
div-inv99.5%
associate-*l*99.5%
*-commutative99.5%
*-commutative99.5%
associate-*l*99.5%
pow-flip99.5%
*-commutative99.5%
*-commutative99.5%
associate-*l*99.5%
distribute-rgt-neg-in99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Taylor expanded in k around 0 99.4%
if 2.74999999999999996e-44 < k Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
sub-neg99.6%
distribute-frac-neg99.6%
+-commutative99.6%
neg-mul-199.6%
*-commutative99.6%
associate-/l*99.6%
fma-define99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
add-sqr-sqrt99.6%
sqrt-unprod99.6%
frac-times99.6%
pow-sqr99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Simplified99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* 2.0 (/ PI k))))
(if (<= k 8e+152)
(* (sqrt n) (sqrt t_0))
(pow (pow (* n t_0) 3.0) 0.16666666666666666))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) / k);
double tmp;
if (k <= 8e+152) {
tmp = sqrt(n) * sqrt(t_0);
} else {
tmp = pow(pow((n * t_0), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI / k);
double tmp;
if (k <= 8e+152) {
tmp = Math.sqrt(n) * Math.sqrt(t_0);
} else {
tmp = Math.pow(Math.pow((n * t_0), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): t_0 = 2.0 * (math.pi / k) tmp = 0 if k <= 8e+152: tmp = math.sqrt(n) * math.sqrt(t_0) else: tmp = math.pow(math.pow((n * t_0), 3.0), 0.16666666666666666) return tmp
function code(k, n) t_0 = Float64(2.0 * Float64(pi / k)) tmp = 0.0 if (k <= 8e+152) tmp = Float64(sqrt(n) * sqrt(t_0)); else tmp = (Float64(n * t_0) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) t_0 = 2.0 * (pi / k); tmp = 0.0; if (k <= 8e+152) tmp = sqrt(n) * sqrt(t_0); else tmp = ((n * t_0) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 8e+152], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(n * t$95$0), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \frac{\pi}{k}\\
\mathbf{if}\;k \leq 8 \cdot 10^{+152}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(n \cdot t\_0\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 8.0000000000000004e152Initial program 99.4%
Taylor expanded in k around 0 52.0%
*-commutative52.0%
associate-/l*51.9%
Simplified51.9%
sqrt-unprod52.1%
Applied egg-rr52.1%
*-un-lft-identity52.1%
*-commutative52.1%
associate-*l*52.1%
Applied egg-rr52.1%
*-lft-identity52.1%
associate-*l/52.1%
*-commutative52.1%
associate-*r*52.1%
*-commutative52.1%
associate-/l*52.2%
*-commutative52.2%
Simplified52.2%
pow1/252.2%
associate-*l*52.2%
unpow-prod-down65.6%
pow1/265.6%
Applied egg-rr65.6%
unpow1/265.6%
Simplified65.6%
if 8.0000000000000004e152 < k Initial program 100.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
associate-/l*2.9%
Simplified2.9%
sqrt-unprod2.9%
Applied egg-rr2.9%
*-un-lft-identity2.9%
*-commutative2.9%
associate-*l*2.9%
Applied egg-rr2.9%
*-lft-identity2.9%
associate-*l/2.9%
*-commutative2.9%
associate-*r*2.9%
*-commutative2.9%
associate-/l*2.9%
*-commutative2.9%
Simplified2.9%
pow1/22.9%
associate-*r/2.9%
associate-*r*2.9%
*-commutative2.9%
associate-*l/2.9%
metadata-eval2.9%
pow-pow11.0%
sqr-pow11.0%
pow-prod-down27.6%
Applied egg-rr27.6%
(FPCore (k n) :precision binary64 (if (<= k 4.9e+228) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (cbrt (pow (* (* n PI) (/ 2.0 k)) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 4.9e+228) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
} else {
tmp = cbrt(pow(((n * ((double) M_PI)) * (2.0 / k)), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.9e+228) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
} else {
tmp = Math.cbrt(Math.pow(((n * Math.PI) * (2.0 / k)), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 4.9e+228) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = cbrt((Float64(Float64(n * pi) * Float64(2.0 / k)) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 4.9e+228], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(N[(n * Pi), $MachinePrecision] * N[(2.0 / k), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.9 \cdot 10^{+228}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(\left(n \cdot \pi\right) \cdot \frac{2}{k}\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 4.9000000000000002e228Initial program 99.4%
Taylor expanded in k around 0 46.5%
*-commutative46.5%
associate-/l*46.4%
Simplified46.4%
sqrt-unprod46.6%
Applied egg-rr46.6%
*-un-lft-identity46.6%
*-commutative46.6%
associate-*l*46.6%
Applied egg-rr46.6%
*-lft-identity46.6%
associate-*l/46.6%
*-commutative46.6%
associate-*r*46.6%
*-commutative46.6%
associate-/l*46.6%
*-commutative46.6%
Simplified46.6%
pow1/246.6%
associate-*l*46.6%
unpow-prod-down58.6%
pow1/258.6%
Applied egg-rr58.6%
unpow1/258.6%
Simplified58.6%
if 4.9000000000000002e228 < k Initial program 100.0%
Taylor expanded in k around 0 2.8%
*-commutative2.8%
associate-/l*2.8%
Simplified2.8%
sqrt-unprod2.8%
Applied egg-rr2.8%
add-cbrt-cube17.3%
pow1/317.3%
add-sqr-sqrt17.3%
pow117.3%
pow1/217.3%
pow-prod-up17.3%
*-commutative17.3%
associate-*l*17.3%
metadata-eval17.3%
Applied egg-rr17.3%
unpow1/317.3%
associate-*l/17.3%
*-commutative17.3%
associate-*r*17.3%
*-commutative17.3%
associate-/l*17.3%
*-commutative17.3%
Simplified17.3%
associate-*r/17.3%
*-commutative17.3%
associate-*l*17.3%
associate-/l*17.3%
*-commutative17.3%
Applied egg-rr17.3%
(FPCore (k n) :precision binary64 (if (<= k 1.8e+216) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (cbrt (pow (* (* n 2.0) (/ PI k)) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 1.8e+216) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
} else {
tmp = cbrt(pow(((n * 2.0) * (((double) M_PI) / k)), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.8e+216) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
} else {
tmp = Math.cbrt(Math.pow(((n * 2.0) * (Math.PI / k)), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.8e+216) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = cbrt((Float64(Float64(n * 2.0) * Float64(pi / k)) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.8e+216], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(N[(n * 2.0), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.8 \cdot 10^{+216}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(\left(n \cdot 2\right) \cdot \frac{\pi}{k}\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 1.8000000000000001e216Initial program 99.4%
Taylor expanded in k around 0 47.1%
*-commutative47.1%
associate-/l*47.0%
Simplified47.0%
sqrt-unprod47.2%
Applied egg-rr47.2%
*-un-lft-identity47.2%
*-commutative47.2%
associate-*l*47.2%
Applied egg-rr47.2%
*-lft-identity47.2%
associate-*l/47.2%
*-commutative47.2%
associate-*r*47.2%
*-commutative47.2%
associate-/l*47.2%
*-commutative47.2%
Simplified47.2%
pow1/247.2%
associate-*l*47.2%
unpow-prod-down59.4%
pow1/259.4%
Applied egg-rr59.4%
unpow1/259.4%
Simplified59.4%
if 1.8000000000000001e216 < k Initial program 100.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
associate-/l*2.9%
Simplified2.9%
sqrt-unprod2.9%
Applied egg-rr2.9%
add-cbrt-cube16.1%
pow1/316.1%
add-sqr-sqrt16.1%
pow116.1%
pow1/216.1%
pow-prod-up16.1%
*-commutative16.1%
associate-*l*16.1%
metadata-eval16.1%
Applied egg-rr16.1%
unpow1/316.1%
associate-*l/16.1%
*-commutative16.1%
associate-*r*16.1%
*-commutative16.1%
associate-/l*16.1%
*-commutative16.1%
Simplified16.1%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* PI (* n 2.0)) (- 0.5 (* k 0.5)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((((double) M_PI) * (n * 2.0)), (0.5 - (k * 0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((Math.PI * (n * 2.0)), (0.5 - (k * 0.5)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((math.pi * (n * 2.0)), (0.5 - (k * 0.5)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(pi * Float64(n * 2.0)) ^ Float64(0.5 - Float64(k * 0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((pi * (n * 2.0)) ^ (0.5 - (k * 0.5))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
metadata-eval99.5%
inv-pow99.5%
sqrt-pow299.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* n 2.0)) (- 0.5 (* k 0.5))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (n * 2.0)), (0.5 - (k * 0.5))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (n * 2.0)), (0.5 - (k * 0.5))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (n * 2.0)), (0.5 - (k * 0.5))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(n * 2.0)) ^ Float64(0.5 - Float64(k * 0.5))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (n * 2.0)) ^ (0.5 - (k * 0.5))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-un-lft-identity99.5%
*-commutative99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* 2.0 (/ PI k)))))
double code(double k, double n) {
return sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
}
public static double code(double k, double n) {
return Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
}
def code(k, n): return math.sqrt(n) * math.sqrt((2.0 * (math.pi / k)))
function code(k, n) return Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); end
code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 40.8%
*-commutative40.8%
associate-/l*40.8%
Simplified40.8%
sqrt-unprod40.9%
Applied egg-rr40.9%
*-un-lft-identity40.9%
*-commutative40.9%
associate-*l*40.9%
Applied egg-rr40.9%
*-lft-identity40.9%
associate-*l/40.9%
*-commutative40.9%
associate-*r*40.9%
*-commutative40.9%
associate-/l*41.0%
*-commutative41.0%
Simplified41.0%
pow1/241.0%
associate-*l*41.0%
unpow-prod-down51.4%
pow1/251.4%
Applied egg-rr51.4%
unpow1/251.4%
Simplified51.4%
(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 * 2.0) * Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt(((n * 2.0) * (pi / k))); end
code[k_, n_] := N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 40.8%
*-commutative40.8%
associate-/l*40.8%
Simplified40.8%
sqrt-unprod40.9%
Applied egg-rr40.9%
*-un-lft-identity40.9%
*-commutative40.9%
associate-*l*40.9%
Applied egg-rr40.9%
*-lft-identity40.9%
associate-*l/40.9%
*-commutative40.9%
associate-*r*40.9%
*-commutative40.9%
associate-/l*41.0%
*-commutative41.0%
Simplified41.0%
herbie shell --seed 2024095
(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))))