
(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 14 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 (* PI (* n 2.0)))) (/ (sqrt t_0) (sqrt (* k (pow t_0 k))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (n * 2.0);
return sqrt(t_0) / sqrt((k * pow(t_0, k)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (n * 2.0);
return Math.sqrt(t_0) / Math.sqrt((k * Math.pow(t_0, k)));
}
def code(k, n): t_0 = math.pi * (n * 2.0) return math.sqrt(t_0) / math.sqrt((k * math.pow(t_0, k)))
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) return Float64(sqrt(t_0) / sqrt(Float64(k * (t_0 ^ k)))) end
function tmp = code(k, n) t_0 = pi * (n * 2.0); tmp = sqrt(t_0) / sqrt((k * (t_0 ^ k))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $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 := \pi \cdot \left(n \cdot 2\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k \cdot {t\_0}^{k}}}
\end{array}
\end{array}
Initial program 99.4%
add-sqr-sqrt99.3%
sqrt-unprod86.7%
*-commutative86.7%
div-sub86.7%
metadata-eval86.7%
div-inv86.7%
*-commutative86.7%
div-sub86.7%
metadata-eval86.7%
div-inv86.7%
Applied egg-rr86.8%
sqr-pow86.6%
pow-sqr86.8%
associate-*r*86.8%
associate-/l*86.8%
metadata-eval86.8%
associate-*r*86.8%
*-commutative86.8%
associate-*r*86.8%
metadata-eval86.8%
associate-*r*86.8%
metadata-eval86.8%
*-lft-identity86.8%
*-commutative86.8%
associate-*l*86.8%
Simplified86.8%
sqrt-div99.5%
pow1/299.5%
pow-unpow99.5%
*-commutative99.5%
pow-unpow99.5%
*-commutative99.5%
associate-*r*99.5%
pow1/299.5%
pow-div99.7%
pow199.7%
pow1/299.7%
pow-unpow99.7%
associate-/r*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 1.36e-62) (* (pow k -0.5) (sqrt (* n (* PI 2.0)))) (pow (/ k (pow (* PI (* n 2.0)) (- 1.0 k))) -0.5)))
double code(double k, double n) {
double tmp;
if (k <= 1.36e-62) {
tmp = pow(k, -0.5) * sqrt((n * (((double) M_PI) * 2.0)));
} else {
tmp = pow((k / pow((((double) M_PI) * (n * 2.0)), (1.0 - k))), -0.5);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.36e-62) {
tmp = Math.pow(k, -0.5) * Math.sqrt((n * (Math.PI * 2.0)));
} else {
tmp = Math.pow((k / Math.pow((Math.PI * (n * 2.0)), (1.0 - k))), -0.5);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.36e-62: tmp = math.pow(k, -0.5) * math.sqrt((n * (math.pi * 2.0))) else: tmp = math.pow((k / math.pow((math.pi * (n * 2.0)), (1.0 - k))), -0.5) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.36e-62) tmp = Float64((k ^ -0.5) * sqrt(Float64(n * Float64(pi * 2.0)))); else tmp = Float64(k / (Float64(pi * Float64(n * 2.0)) ^ Float64(1.0 - k))) ^ -0.5; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.36e-62) tmp = (k ^ -0.5) * sqrt((n * (pi * 2.0))); else tmp = (k / ((pi * (n * 2.0)) ^ (1.0 - k))) ^ -0.5; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.36e-62], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(k / N[Power[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.36 \cdot 10^{-62}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{n \cdot \left(\pi \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{k}{{\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(1 - k\right)}}\right)}^{-0.5}\\
\end{array}
\end{array}
if k < 1.35999999999999999e-62Initial program 99.4%
Taylor expanded in k around 0 99.3%
pow199.3%
associate-*l/99.3%
*-un-lft-identity99.3%
sqrt-unprod99.4%
*-commutative99.4%
associate-*r*99.4%
sqrt-undiv67.5%
Applied egg-rr67.5%
unpow167.5%
associate-/l*67.5%
*-commutative67.5%
associate-/l*67.5%
Simplified67.5%
sqrt-prod67.1%
associate-*r/67.1%
*-commutative67.1%
sqrt-div99.0%
associate-/l*99.1%
sqrt-prod99.4%
*-un-lft-identity99.4%
associate-*l/99.4%
pow1/299.4%
pow-flip99.5%
metadata-eval99.5%
*-commutative99.5%
associate-*l*99.5%
Applied egg-rr99.5%
if 1.35999999999999999e-62 < k Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod99.5%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
Applied egg-rr99.5%
sqr-pow99.5%
pow-sqr99.5%
associate-*r*99.5%
associate-/l*99.5%
metadata-eval99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r*99.5%
metadata-eval99.5%
associate-*r*99.5%
metadata-eval99.5%
*-lft-identity99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
clear-num99.5%
sqrt-div99.5%
metadata-eval99.5%
Applied egg-rr99.5%
inv-pow99.5%
sqrt-pow299.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 1.5e-62) (* (pow k -0.5) (sqrt (* n (* PI 2.0)))) (sqrt (/ (pow (* PI (* n 2.0)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 1.5e-62) {
tmp = pow(k, -0.5) * sqrt((n * (((double) M_PI) * 2.0)));
} else {
tmp = sqrt((pow((((double) M_PI) * (n * 2.0)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.5e-62) {
tmp = Math.pow(k, -0.5) * Math.sqrt((n * (Math.PI * 2.0)));
} else {
tmp = Math.sqrt((Math.pow((Math.PI * (n * 2.0)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.5e-62: tmp = math.pow(k, -0.5) * math.sqrt((n * (math.pi * 2.0))) else: tmp = math.sqrt((math.pow((math.pi * (n * 2.0)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.5e-62) tmp = Float64((k ^ -0.5) * sqrt(Float64(n * Float64(pi * 2.0)))); else tmp = sqrt(Float64((Float64(pi * Float64(n * 2.0)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.5e-62) tmp = (k ^ -0.5) * sqrt((n * (pi * 2.0))); else tmp = sqrt((((pi * (n * 2.0)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.5e-62], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.5 \cdot 10^{-62}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{n \cdot \left(\pi \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 1.5000000000000001e-62Initial program 99.4%
Taylor expanded in k around 0 99.3%
pow199.3%
associate-*l/99.3%
*-un-lft-identity99.3%
sqrt-unprod99.4%
*-commutative99.4%
associate-*r*99.4%
sqrt-undiv67.5%
Applied egg-rr67.5%
unpow167.5%
associate-/l*67.5%
*-commutative67.5%
associate-/l*67.5%
Simplified67.5%
sqrt-prod67.1%
associate-*r/67.1%
*-commutative67.1%
sqrt-div99.0%
associate-/l*99.1%
sqrt-prod99.4%
*-un-lft-identity99.4%
associate-*l/99.4%
pow1/299.4%
pow-flip99.5%
metadata-eval99.5%
*-commutative99.5%
associate-*l*99.5%
Applied egg-rr99.5%
if 1.5000000000000001e-62 < k Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod99.5%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
Applied egg-rr99.5%
sqr-pow99.5%
pow-sqr99.5%
associate-*r*99.5%
associate-/l*99.5%
metadata-eval99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r*99.5%
metadata-eval99.5%
associate-*r*99.5%
metadata-eval99.5%
*-lft-identity99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 1.4e+49) (* (pow k -0.5) (sqrt (* n (* PI 2.0)))) (sqrt (+ -1.0 (fma n (* 2.0 (/ PI k)) 1.0)))))
double code(double k, double n) {
double tmp;
if (k <= 1.4e+49) {
tmp = pow(k, -0.5) * sqrt((n * (((double) M_PI) * 2.0)));
} else {
tmp = sqrt((-1.0 + fma(n, (2.0 * (((double) M_PI) / k)), 1.0)));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.4e+49) tmp = Float64((k ^ -0.5) * sqrt(Float64(n * Float64(pi * 2.0)))); else tmp = sqrt(Float64(-1.0 + fma(n, Float64(2.0 * Float64(pi / k)), 1.0))); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.4e+49], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(-1.0 + N[(n * N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.4 \cdot 10^{+49}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{n \cdot \left(\pi \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{-1 + \mathsf{fma}\left(n, 2 \cdot \frac{\pi}{k}, 1\right)}\\
\end{array}
\end{array}
if k < 1.3999999999999999e49Initial program 99.0%
Taylor expanded in k around 0 84.4%
pow184.4%
associate-*l/84.4%
*-un-lft-identity84.4%
sqrt-unprod84.5%
*-commutative84.5%
associate-*r*84.5%
sqrt-undiv62.7%
Applied egg-rr62.7%
unpow162.7%
associate-/l*62.7%
*-commutative62.7%
associate-/l*62.7%
Simplified62.7%
sqrt-prod62.4%
associate-*r/62.4%
*-commutative62.4%
sqrt-div84.2%
associate-/l*84.3%
sqrt-prod84.5%
*-un-lft-identity84.5%
associate-*l/84.5%
pow1/284.5%
pow-flip84.6%
metadata-eval84.6%
*-commutative84.6%
associate-*l*84.6%
Applied egg-rr84.6%
if 1.3999999999999999e49 < k Initial program 100.0%
Taylor expanded in k around 0 2.8%
pow12.8%
associate-*l/2.8%
*-un-lft-identity2.8%
sqrt-unprod2.8%
*-commutative2.8%
associate-*r*2.8%
sqrt-undiv2.7%
Applied egg-rr2.7%
unpow12.7%
associate-/l*2.7%
*-commutative2.7%
associate-/l*2.7%
Simplified2.7%
expm1-log1p-u2.7%
expm1-undefine32.3%
*-commutative32.3%
associate-*l*32.3%
Applied egg-rr32.3%
sub-neg32.3%
metadata-eval32.3%
+-commutative32.3%
log1p-undefine32.3%
rem-exp-log32.3%
+-commutative32.3%
*-commutative32.3%
associate-*l/32.3%
associate-/l*32.3%
associate-*l*32.3%
fma-define32.3%
Simplified32.3%
Final simplification62.7%
(FPCore (k n) :precision binary64 (if (<= k 4.4e+234) (/ (sqrt (* PI (* n 2.0))) (sqrt k)) (cbrt (pow (* 2.0 (* PI (/ n k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 4.4e+234) {
tmp = sqrt((((double) M_PI) * (n * 2.0))) / sqrt(k);
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) * (n / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.4e+234) {
tmp = Math.sqrt((Math.PI * (n * 2.0))) / Math.sqrt(k);
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI * (n / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 4.4e+234) tmp = Float64(sqrt(Float64(pi * Float64(n * 2.0))) / sqrt(k)); else tmp = cbrt((Float64(2.0 * Float64(pi * Float64(n / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 4.4e+234], N[(N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.4 \cdot 10^{+234}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(n \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 4.40000000000000015e234Initial program 99.4%
Taylor expanded in k around 0 57.1%
associate-*l/57.1%
*-un-lft-identity57.1%
sqrt-unprod57.1%
*-commutative57.1%
associate-*r*57.1%
Applied egg-rr57.1%
if 4.40000000000000015e234 < k Initial program 100.0%
Taylor expanded in k around 0 2.9%
pow12.9%
associate-*l/2.9%
*-un-lft-identity2.9%
sqrt-unprod2.9%
*-commutative2.9%
associate-*r*2.9%
sqrt-undiv2.8%
Applied egg-rr2.8%
unpow12.8%
associate-/l*2.8%
*-commutative2.8%
associate-/l*2.8%
Simplified2.8%
add-cbrt-cube20.7%
add-sqr-sqrt20.7%
pow120.7%
pow1/220.7%
pow-prod-up20.7%
*-commutative20.7%
associate-*l*20.7%
metadata-eval20.7%
Applied egg-rr20.7%
Final simplification52.6%
(FPCore (k n) :precision binary64 (if (<= k 7.2e+236) (* (pow k -0.5) (sqrt (* n (* PI 2.0)))) (cbrt (pow (* 2.0 (* PI (/ n k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 7.2e+236) {
tmp = pow(k, -0.5) * sqrt((n * (((double) M_PI) * 2.0)));
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) * (n / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 7.2e+236) {
tmp = Math.pow(k, -0.5) * Math.sqrt((n * (Math.PI * 2.0)));
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI * (n / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 7.2e+236) tmp = Float64((k ^ -0.5) * sqrt(Float64(n * Float64(pi * 2.0)))); else tmp = cbrt((Float64(2.0 * Float64(pi * Float64(n / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 7.2e+236], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 7.2 \cdot 10^{+236}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{n \cdot \left(\pi \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 7.1999999999999999e236Initial program 99.4%
Taylor expanded in k around 0 57.1%
pow157.1%
associate-*l/57.1%
*-un-lft-identity57.1%
sqrt-unprod57.1%
*-commutative57.1%
associate-*r*57.1%
sqrt-undiv42.6%
Applied egg-rr42.6%
unpow142.6%
associate-/l*42.6%
*-commutative42.6%
associate-/l*42.6%
Simplified42.6%
sqrt-prod42.4%
associate-*r/42.4%
*-commutative42.4%
sqrt-div57.0%
associate-/l*57.0%
sqrt-prod57.1%
*-un-lft-identity57.1%
associate-*l/57.1%
pow1/257.1%
pow-flip57.2%
metadata-eval57.2%
*-commutative57.2%
associate-*l*57.2%
Applied egg-rr57.2%
if 7.1999999999999999e236 < k Initial program 100.0%
Taylor expanded in k around 0 2.9%
pow12.9%
associate-*l/2.9%
*-un-lft-identity2.9%
sqrt-unprod2.9%
*-commutative2.9%
associate-*r*2.9%
sqrt-undiv2.8%
Applied egg-rr2.8%
unpow12.8%
associate-/l*2.8%
*-commutative2.8%
associate-/l*2.8%
Simplified2.8%
add-cbrt-cube20.7%
add-sqr-sqrt20.7%
pow120.7%
pow1/220.7%
pow-prod-up20.7%
*-commutative20.7%
associate-*l*20.7%
metadata-eval20.7%
Applied egg-rr20.7%
Final simplification52.6%
(FPCore (k n) :precision binary64 (* (pow (* 2.0 (* PI n)) (* (- 1.0 k) 0.5)) (pow k -0.5)))
double code(double k, double n) {
return pow((2.0 * (((double) M_PI) * n)), ((1.0 - k) * 0.5)) * pow(k, -0.5);
}
public static double code(double k, double n) {
return Math.pow((2.0 * (Math.PI * n)), ((1.0 - k) * 0.5)) * Math.pow(k, -0.5);
}
def code(k, n): return math.pow((2.0 * (math.pi * n)), ((1.0 - k) * 0.5)) * math.pow(k, -0.5)
function code(k, n) return Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(Float64(1.0 - k) * 0.5)) * (k ^ -0.5)) end
function tmp = code(k, n) tmp = ((2.0 * (pi * n)) ^ ((1.0 - k) * 0.5)) * (k ^ -0.5); end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\left(1 - k\right) \cdot 0.5\right)} \cdot {k}^{-0.5}
\end{array}
Initial program 99.4%
associate-*l/99.5%
*-lft-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
div-inv99.4%
metadata-eval99.4%
div-sub99.4%
unpow-prod-down75.8%
unpow-prod-down99.4%
associate-*l*99.4%
div-inv99.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 (* n (* PI 2.0)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((n * (((double) M_PI) * 2.0)), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((n * (Math.PI * 2.0)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((n * (math.pi * 2.0)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(n * Float64(pi * 2.0)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((n * (pi * 2.0)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
associate-*l/99.5%
*-lft-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (/ (sqrt (* PI (* n 2.0))) (sqrt k)))
double code(double k, double n) {
return sqrt((((double) M_PI) * (n * 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (n * 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((math.pi * (n * 2.0))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(pi * Float64(n * 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((pi * (n * 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\pi \cdot \left(n \cdot 2\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 50.3%
associate-*l/50.3%
*-un-lft-identity50.3%
sqrt-unprod50.4%
*-commutative50.4%
associate-*r*50.4%
Applied egg-rr50.4%
Final simplification50.4%
(FPCore (k n) :precision binary64 (pow (/ k (* n (* PI 2.0))) -0.5))
double code(double k, double n) {
return pow((k / (n * (((double) M_PI) * 2.0))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / (n * (Math.PI * 2.0))), -0.5);
}
def code(k, n): return math.pow((k / (n * (math.pi * 2.0))), -0.5)
function code(k, n) return Float64(k / Float64(n * Float64(pi * 2.0))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (n * (pi * 2.0))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{n \cdot \left(\pi \cdot 2\right)}\right)}^{-0.5}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 50.3%
pow150.3%
associate-*l/50.3%
*-un-lft-identity50.3%
sqrt-unprod50.4%
*-commutative50.4%
associate-*r*50.4%
sqrt-undiv37.6%
Applied egg-rr37.6%
unpow137.6%
associate-/l*37.6%
*-commutative37.6%
associate-/l*37.6%
Simplified37.6%
sqrt-prod37.5%
associate-*r/37.5%
*-commutative37.5%
sqrt-div50.2%
associate-/l*50.2%
sqrt-prod50.4%
clear-num50.3%
inv-pow50.3%
sqrt-undiv38.4%
sqrt-pow238.5%
*-commutative38.5%
associate-*l*38.5%
metadata-eval38.5%
Applied egg-rr38.5%
Final simplification38.5%
(FPCore (k n) :precision binary64 (sqrt (* n (/ (* PI 2.0) k))))
double code(double k, double n) {
return sqrt((n * ((((double) M_PI) * 2.0) / k)));
}
public static double code(double k, double n) {
return Math.sqrt((n * ((Math.PI * 2.0) / k)));
}
def code(k, n): return math.sqrt((n * ((math.pi * 2.0) / k)))
function code(k, n) return sqrt(Float64(n * Float64(Float64(pi * 2.0) / k))) end
function tmp = code(k, n) tmp = sqrt((n * ((pi * 2.0) / k))); end
code[k_, n_] := N[Sqrt[N[(n * N[(N[(Pi * 2.0), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \frac{\pi \cdot 2}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 50.3%
pow150.3%
associate-*l/50.3%
*-un-lft-identity50.3%
sqrt-unprod50.4%
*-commutative50.4%
associate-*r*50.4%
sqrt-undiv37.6%
Applied egg-rr37.6%
unpow137.6%
associate-/l*37.6%
*-commutative37.6%
associate-/l*37.6%
Simplified37.6%
Taylor expanded in n around 0 37.6%
associate-*r/37.6%
associate-*r*37.6%
*-commutative37.6%
associate-*r*37.6%
associate-/l*37.6%
Simplified37.6%
Final simplification37.6%
(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 50.3%
pow150.3%
associate-*l/50.3%
*-un-lft-identity50.3%
sqrt-unprod50.4%
*-commutative50.4%
associate-*r*50.4%
sqrt-undiv37.6%
Applied egg-rr37.6%
unpow137.6%
associate-/l*37.6%
*-commutative37.6%
associate-/l*37.6%
Simplified37.6%
Final simplification37.6%
(FPCore (k n) :precision binary64 (sqrt (/ (* PI 2.0) (/ k n))))
double code(double k, double n) {
return sqrt(((((double) M_PI) * 2.0) / (k / n)));
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI * 2.0) / (k / n)));
}
def code(k, n): return math.sqrt(((math.pi * 2.0) / (k / n)))
function code(k, n) return sqrt(Float64(Float64(pi * 2.0) / Float64(k / n))) end
function tmp = code(k, n) tmp = sqrt(((pi * 2.0) / (k / n))); end
code[k_, n_] := N[Sqrt[N[(N[(Pi * 2.0), $MachinePrecision] / N[(k / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi \cdot 2}{\frac{k}{n}}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 50.3%
pow150.3%
associate-*l/50.3%
*-un-lft-identity50.3%
sqrt-unprod50.4%
*-commutative50.4%
associate-*r*50.4%
sqrt-undiv37.6%
Applied egg-rr37.6%
unpow137.6%
associate-/l*37.6%
*-commutative37.6%
associate-/l*37.6%
Simplified37.6%
associate-*r*37.6%
clear-num37.6%
un-div-inv37.6%
*-commutative37.6%
Applied egg-rr37.6%
Final simplification37.6%
(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(Float64(pi * Float64(n * 2.0)) / k)) end
function tmp = code(k, n) tmp = sqrt(((pi * (n * 2.0)) / k)); end
code[k_, n_] := N[Sqrt[N[(N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi \cdot \left(n \cdot 2\right)}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 50.3%
associate-*l/50.3%
*-un-lft-identity50.3%
sqrt-unprod50.4%
*-commutative50.4%
associate-*r*50.4%
sqrt-undiv37.6%
Applied egg-rr37.6%
Final simplification37.6%
herbie shell --seed 2024043
(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))))