
(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 19 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 (/ 1.0 k)) (sqrt t_0)) (pow t_0 (* k 0.5)))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return (sqrt((1.0 / k)) * sqrt(t_0)) / 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((1.0 / k)) * Math.sqrt(t_0)) / Math.pow(t_0, (k * 0.5));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.sqrt((1.0 / k)) * math.sqrt(t_0)) / math.pow(t_0, (k * 0.5))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64(sqrt(Float64(1.0 / k)) * sqrt(t_0)) / (t_0 ^ Float64(k * 0.5))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = (sqrt((1.0 / k)) * sqrt(t_0)) / (t_0 ^ (k * 0.5)); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{\sqrt{\frac{1}{k}} \cdot \sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
pow-div99.6%
pow1/299.6%
associate-*r/99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in k around 0 99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* 2.0 (* PI n)))) (/ (* (sqrt t_0) (pow k -0.5)) (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) * pow(k, -0.5)) / 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.pow(k, -0.5)) / Math.pow(t_0, (k * 0.5));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.sqrt(t_0) * math.pow(k, -0.5)) / math.pow(t_0, (k * 0.5))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64(sqrt(t_0) * (k ^ -0.5)) / (t_0 ^ Float64(k * 0.5))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = (sqrt(t_0) * (k ^ -0.5)) / (t_0 ^ (k * 0.5)); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{\sqrt{t\_0} \cdot {k}^{-0.5}}{{t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
pow-div99.6%
pow1/299.6%
associate-*r/99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* 2.0 PI)))) (/ (* (sqrt t_0) (pow t_0 (* k -0.5))) (sqrt k))))
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))) / sqrt(k);
}
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.sqrt(k);
}
def code(k, n): t_0 = n * (2.0 * math.pi) return (math.sqrt(t_0) * math.pow(t_0, (k * -0.5))) / math.sqrt(k)
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) return Float64(Float64(sqrt(t_0) * (t_0 ^ Float64(k * -0.5))) / sqrt(k)) end
function tmp = code(k, n) t_0 = n * (2.0 * pi); tmp = (sqrt(t_0) * (t_0 ^ (k * -0.5))) / sqrt(k); end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Power[t$95$0, N[(k * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\frac{\sqrt{t\_0} \cdot {t\_0}^{\left(k \cdot -0.5\right)}}{\sqrt{k}}
\end{array}
\end{array}
Initial program 99.4%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in k around inf 96.8%
exp-to-pow99.5%
*-commutative99.5%
cancel-sign-sub-inv99.5%
unpow-prod-up99.7%
pow1/299.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* 2.0 n)))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = math.pi * (2.0 * n) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * 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 := \pi \cdot \left(2 \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.4%
associate-*l/99.5%
*-un-lft-identity99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-/l/99.7%
unpow1/299.7%
metadata-eval99.7%
pow-sqr99.5%
fabs-sqr99.5%
pow-sqr99.7%
metadata-eval99.7%
unpow1/299.7%
fabs-neg99.7%
neg-mul-199.7%
rem-square-sqrt0.0%
unpow1/20.0%
metadata-eval0.0%
pow-sqr0.0%
unswap-sqr0.0%
fabs-sqr0.0%
unswap-sqr0.0%
rem-square-sqrt31.3%
pow-sqr31.3%
metadata-eval31.3%
unpow1/231.3%
neg-mul-131.3%
Simplified99.7%
(FPCore (k n) :precision binary64 (if (<= k 7.5e-40) (* (/ 1.0 (sqrt (/ k PI))) (sqrt (* 2.0 n))) (sqrt (/ (pow (* 2.0 (* PI n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 7.5e-40) {
tmp = (1.0 / sqrt((k / ((double) M_PI)))) * sqrt((2.0 * n));
} 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 <= 7.5e-40) {
tmp = (1.0 / Math.sqrt((k / Math.PI))) * Math.sqrt((2.0 * n));
} 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 <= 7.5e-40: tmp = (1.0 / math.sqrt((k / math.pi))) * math.sqrt((2.0 * n)) 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 <= 7.5e-40) tmp = Float64(Float64(1.0 / sqrt(Float64(k / pi))) * sqrt(Float64(2.0 * n))); 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 <= 7.5e-40) tmp = (1.0 / sqrt((k / pi))) * sqrt((2.0 * n)); else tmp = sqrt((((2.0 * (pi * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 7.5e-40], N[(N[(1.0 / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $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 7.5 \cdot 10^{-40}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{\pi}}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 7.50000000000000069e-40Initial program 99.2%
Taylor expanded in k around 0 70.0%
*-commutative70.0%
associate-/l*70.0%
Simplified70.0%
sqrt-unprod69.2%
Applied egg-rr69.2%
pow1/269.2%
associate-*r*69.2%
unpow-prod-down98.5%
pow1/298.5%
Applied egg-rr98.5%
*-commutative98.5%
unpow1/298.5%
*-commutative98.5%
Simplified98.5%
clear-num98.6%
sqrt-div99.3%
metadata-eval99.3%
Applied egg-rr99.3%
if 7.50000000000000069e-40 < k Initial program 99.6%
Applied egg-rr99.6%
*-commutative99.6%
distribute-lft-in99.6%
metadata-eval99.6%
*-commutative99.6%
associate-*r*99.6%
metadata-eval99.6%
neg-mul-199.6%
sub-neg99.6%
Simplified99.6%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 2.45e+145) (* (/ 1.0 (sqrt (/ k PI))) (sqrt (* 2.0 n))) (pow (pow (* PI (* 2.0 (/ n k))) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 2.45e+145) {
tmp = (1.0 / sqrt((k / ((double) M_PI)))) * sqrt((2.0 * n));
} else {
tmp = pow(pow((((double) M_PI) * (2.0 * (n / k))), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.45e+145) {
tmp = (1.0 / Math.sqrt((k / Math.PI))) * Math.sqrt((2.0 * n));
} else {
tmp = Math.pow(Math.pow((Math.PI * (2.0 * (n / k))), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2.45e+145: tmp = (1.0 / math.sqrt((k / math.pi))) * math.sqrt((2.0 * n)) else: tmp = math.pow(math.pow((math.pi * (2.0 * (n / k))), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 2.45e+145) tmp = Float64(Float64(1.0 / sqrt(Float64(k / pi))) * sqrt(Float64(2.0 * n))); else tmp = (Float64(pi * Float64(2.0 * Float64(n / k))) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.45e+145) tmp = (1.0 / sqrt((k / pi))) * sqrt((2.0 * n)); else tmp = ((pi * (2.0 * (n / k))) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.45e+145], N[(N[(1.0 / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(Pi * N[(2.0 * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.45 \cdot 10^{+145}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{\pi}}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\pi \cdot \left(2 \cdot \frac{n}{k}\right)\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 2.45000000000000001e145Initial program 99.2%
Taylor expanded in k around 0 44.9%
*-commutative44.9%
associate-/l*44.9%
Simplified44.9%
sqrt-unprod44.5%
Applied egg-rr44.5%
pow1/244.5%
associate-*r*44.5%
unpow-prod-down61.2%
pow1/261.2%
Applied egg-rr61.2%
*-commutative61.2%
unpow1/261.2%
*-commutative61.2%
Simplified61.2%
clear-num61.3%
sqrt-div61.7%
metadata-eval61.7%
Applied egg-rr61.7%
if 2.45000000000000001e145 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
*-commutative2.7%
associate-/l*2.7%
Simplified2.7%
sqrt-unprod2.7%
Applied egg-rr2.7%
associate-*r/2.7%
*-commutative2.7%
Applied egg-rr2.7%
pow1/22.7%
associate-*r/2.7%
*-commutative2.7%
associate-*l*2.7%
associate-*r/2.7%
metadata-eval2.7%
pow-pow7.9%
sqr-pow7.9%
pow-prod-down19.9%
pow-prod-up19.9%
metadata-eval19.9%
*-commutative19.9%
associate-*l*19.9%
metadata-eval19.9%
Applied egg-rr19.9%
associate-*r/19.9%
associate-/l*19.9%
cube-div20.1%
*-rgt-identity20.1%
cube-div19.9%
associate-*r*19.9%
times-frac19.9%
/-rgt-identity19.9%
*-commutative19.9%
associate-/l*19.9%
Simplified19.9%
Final simplification49.9%
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (pow (* n (* 2.0 PI)) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return sqrt((1.0 / k)) * pow((n * (2.0 * ((double) M_PI))), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / k)) * Math.pow((n * (2.0 * Math.PI)), ((1.0 - k) / 2.0));
}
def code(k, n): return math.sqrt((1.0 / k)) * math.pow((n * (2.0 * math.pi)), ((1.0 - k) / 2.0))
function code(k, n) return Float64(sqrt(Float64(1.0 / k)) * (Float64(n * Float64(2.0 * pi)) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)) * ((n * (2.0 * pi)) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision] * N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{k}} \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (+ 0.5 (* k -0.5)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), (0.5 + (k * -0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), (0.5 + (k * -0.5)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), (0.5 + (k * -0.5)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 + Float64(k * -0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ (0.5 + (k * -0.5))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 + N[(k * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 + k \cdot -0.5\right)}
\end{array}
Initial program 99.4%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
metadata-eval99.5%
div-sub99.5%
associate-*r*99.5%
div-inv99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
sub-neg99.4%
div-inv99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
pow1/299.4%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(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.4%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt (/ k PI))) (sqrt (* 2.0 n))))
double code(double k, double n) {
return (1.0 / sqrt((k / ((double) M_PI)))) * sqrt((2.0 * n));
}
public static double code(double k, double n) {
return (1.0 / Math.sqrt((k / Math.PI))) * Math.sqrt((2.0 * n));
}
def code(k, n): return (1.0 / math.sqrt((k / math.pi))) * math.sqrt((2.0 * n))
function code(k, n) return Float64(Float64(1.0 / sqrt(Float64(k / pi))) * sqrt(Float64(2.0 * n))) end
function tmp = code(k, n) tmp = (1.0 / sqrt((k / pi))) * sqrt((2.0 * n)); end
code[k_, n_] := N[(N[(1.0 / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{k}{\pi}}} \cdot \sqrt{2 \cdot n}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
pow1/232.7%
associate-*r*32.7%
unpow-prod-down44.8%
pow1/244.8%
Applied egg-rr44.8%
*-commutative44.8%
unpow1/244.8%
*-commutative44.8%
Simplified44.8%
clear-num44.8%
sqrt-div45.1%
metadata-eval45.1%
Applied egg-rr45.1%
Final simplification45.1%
(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(n * Float64(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 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
associate-*r/32.8%
*-commutative32.8%
Applied egg-rr32.8%
associate-*r/32.8%
*-commutative32.8%
associate-*l*32.8%
sqrt-div45.1%
*-commutative45.1%
associate-*r*45.1%
Applied egg-rr45.1%
(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.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
pow1/232.7%
associate-*r*32.7%
unpow-prod-down44.8%
pow1/244.8%
Applied egg-rr44.8%
*-commutative44.8%
unpow1/244.8%
*-commutative44.8%
Simplified44.8%
Final simplification44.8%
(FPCore (k n) :precision binary64 (* (sqrt (* PI (/ 2.0 k))) (sqrt n)))
double code(double k, double n) {
return sqrt((((double) M_PI) * (2.0 / k))) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (2.0 / k))) * Math.sqrt(n);
}
def code(k, n): return math.sqrt((math.pi * (2.0 / k))) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(pi * Float64(2.0 / k))) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt((pi * (2.0 / k))) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
sqrt-prod33.1%
*-commutative33.1%
sqrt-unprod44.8%
associate-*r*44.7%
sqrt-unprod44.8%
Applied egg-rr44.8%
associate-*r/44.8%
*-commutative44.8%
associate-/l*44.8%
Simplified44.8%
(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.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
sqrt-prod33.1%
*-commutative33.1%
sqrt-unprod44.8%
associate-*r*44.7%
sqrt-unprod44.8%
Applied egg-rr44.8%
Final simplification44.8%
(FPCore (k n) :precision binary64 (* (sqrt 2.0) (sqrt (* n (/ PI k)))))
double code(double k, double n) {
return sqrt(2.0) * sqrt((n * (((double) M_PI) / k)));
}
public static double code(double k, double n) {
return Math.sqrt(2.0) * Math.sqrt((n * (Math.PI / k)));
}
def code(k, n): return math.sqrt(2.0) * math.sqrt((n * (math.pi / k)))
function code(k, n) return Float64(sqrt(2.0) * sqrt(Float64(n * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt(2.0) * sqrt((n * (pi / k))); end
code[k_, n_] := N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(n * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2} \cdot \sqrt{n \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
(FPCore (k n) :precision binary64 (sqrt (/ 1.0 (/ k (* n (* 2.0 PI))))))
double code(double k, double n) {
return sqrt((1.0 / (k / (n * (2.0 * ((double) M_PI))))));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / (k / (n * (2.0 * Math.PI)))));
}
def code(k, n): return math.sqrt((1.0 / (k / (n * (2.0 * math.pi)))))
function code(k, n) return sqrt(Float64(1.0 / Float64(k / Float64(n * Float64(2.0 * pi))))) end
function tmp = code(k, n) tmp = sqrt((1.0 / (k / (n * (2.0 * pi))))); end
code[k_, n_] := N[Sqrt[N[(1.0 / N[(k / N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{\frac{k}{n \cdot \left(2 \cdot \pi\right)}}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
associate-*r/32.8%
*-commutative32.8%
Applied egg-rr32.8%
associate-*r/32.8%
*-commutative32.8%
associate-*l*32.8%
clear-num32.8%
*-commutative32.8%
associate-*r*32.8%
Applied egg-rr32.8%
(FPCore (k n) :precision binary64 (sqrt (* PI (* 2.0 (/ n k)))))
double code(double k, double n) {
return sqrt((((double) M_PI) * (2.0 * (n / k))));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (2.0 * (n / k))));
}
def code(k, n): return math.sqrt((math.pi * (2.0 * (n / k))))
function code(k, n) return sqrt(Float64(pi * Float64(2.0 * Float64(n / k)))) end
function tmp = code(k, n) tmp = sqrt((pi * (2.0 * (n / k)))); end
code[k_, n_] := N[Sqrt[N[(Pi * N[(2.0 * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \left(2 \cdot \frac{n}{k}\right)}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
associate-*r/32.8%
*-commutative32.8%
Applied egg-rr32.8%
Taylor expanded in n around 0 32.8%
associate-*r/32.8%
associate-*r*32.8%
*-commutative32.8%
associate-*l/32.8%
*-commutative32.8%
associate-/l*32.8%
Simplified32.8%
Final simplification32.8%
(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.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
associate-*r/32.8%
*-commutative32.8%
Applied egg-rr32.8%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (* n (/ PI k)))))
double code(double k, double n) {
return sqrt((2.0 * (n * (((double) M_PI) / k))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (n * (Math.PI / k))));
}
def code(k, n): return math.sqrt((2.0 * (n * (math.pi / k))))
function code(k, n) return sqrt(Float64(2.0 * Float64(n * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (n * (pi / k)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 33.0%
*-commutative33.0%
associate-/l*33.1%
Simplified33.1%
sqrt-unprod32.7%
Applied egg-rr32.7%
herbie shell --seed 2024146
(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))))