
(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 (if (<= k 6.6e-66) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (sqrt (/ (pow (* PI (* 2.0 n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 6.6e-66) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} else {
tmp = sqrt((pow((((double) M_PI) * (2.0 * n)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 6.6e-66) {
tmp = Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
} else {
tmp = Math.sqrt((Math.pow((Math.PI * (2.0 * n)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 6.6e-66: tmp = math.sqrt((math.pi / k)) * math.sqrt((2.0 * n)) else: tmp = math.sqrt((math.pow((math.pi * (2.0 * n)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 6.6e-66) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); else tmp = sqrt(Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 6.6e-66) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); else tmp = sqrt((((pi * (2.0 * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 6.6e-66], N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.6 \cdot 10^{-66}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 6.5999999999999998e-66Initial program 99.2%
Taylor expanded in k around 0 99.1%
associate-*l/99.2%
*-un-lft-identity99.2%
*-commutative99.2%
sqrt-prod99.3%
associate-*r*99.3%
*-commutative99.3%
pow199.3%
sqrt-undiv68.7%
Applied egg-rr68.7%
unpow168.7%
associate-/l*68.7%
associate-/r/68.7%
Simplified68.7%
sqrt-prod99.5%
Applied egg-rr99.5%
if 6.5999999999999998e-66 < k Initial program 99.8%
associate-*l/99.8%
*-lft-identity99.8%
sqr-pow99.8%
pow-sqr99.8%
*-commutative99.8%
associate-*l*99.8%
associate-*r/99.8%
associate-/l*99.7%
associate-/r/99.8%
metadata-eval99.8%
*-lft-identity99.8%
div-sub99.8%
sub-neg99.8%
distribute-frac-neg99.8%
metadata-eval99.8%
neg-mul-199.8%
associate-/l*99.8%
associate-/r/99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in k around inf 98.8%
add-sqr-sqrt98.8%
sqrt-unprod98.8%
frac-times98.8%
Applied egg-rr99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-in99.8%
metadata-eval99.8%
*-commutative99.8%
associate-*r*99.8%
metadata-eval99.8%
neg-mul-199.8%
Simplified99.8%
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.6%
associate-*l/99.6%
*-commutative99.6%
associate-*r*99.6%
*-un-lft-identity99.6%
div-sub99.6%
metadata-eval99.6%
pow-sub99.7%
unpow1/299.7%
associate-/l/99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Applied egg-rr99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* n (* PI 2.0)) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return pow(k, -0.5) * pow((n * (((double) M_PI) * 2.0)), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((n * (Math.PI * 2.0)), ((1.0 - k) / 2.0));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((n * (math.pi * 2.0)), ((1.0 - k) / 2.0))
function code(k, n) return Float64((k ^ -0.5) * (Float64(n * Float64(pi * 2.0)) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((n * (pi * 2.0)) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.6%
expm1-log1p-u96.1%
expm1-udef75.0%
pow1/275.0%
pow-flip75.0%
metadata-eval75.0%
Applied egg-rr75.0%
expm1-def96.1%
expm1-log1p99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (+ 0.5 (* k -0.5))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), (0.5 + (k * -0.5))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), (0.5 + (k * -0.5))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), (0.5 + (k * -0.5))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(0.5 + Float64(k * -0.5))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ (0.5 + (k * -0.5))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $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(2 \cdot n\right)\right)}^{\left(0.5 + k \cdot -0.5\right)}}{\sqrt{k}}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
sqr-pow99.4%
pow-sqr99.6%
*-commutative99.6%
associate-*l*99.6%
associate-*r/99.6%
associate-/l*99.6%
associate-/r/99.6%
metadata-eval99.6%
*-lft-identity99.6%
div-sub99.6%
sub-neg99.6%
distribute-frac-neg99.6%
metadata-eval99.6%
neg-mul-199.6%
associate-/l*99.6%
associate-/r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 7.5e+226) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (pow (pow (* PI (* 2.0 (/ n k))) 2.0) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 7.5e+226) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} else {
tmp = pow(pow((((double) M_PI) * (2.0 * (n / k))), 2.0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 7.5e+226) {
tmp = Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
} else {
tmp = Math.pow(Math.pow((Math.PI * (2.0 * (n / k))), 2.0), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 7.5e+226: tmp = math.sqrt((math.pi / k)) * math.sqrt((2.0 * n)) else: tmp = math.pow(math.pow((math.pi * (2.0 * (n / k))), 2.0), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 7.5e+226) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); else tmp = (Float64(pi * Float64(2.0 * Float64(n / k))) ^ 2.0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 7.5e+226) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); else tmp = ((pi * (2.0 * (n / k))) ^ 2.0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 7.5e+226], N[(N[Sqrt[N[(Pi / k), $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], 2.0], $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 7.5 \cdot 10^{+226}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\pi \cdot \left(2 \cdot \frac{n}{k}\right)\right)}^{2}\right)}^{0.25}\\
\end{array}
\end{array}
if k < 7.49999999999999964e226Initial program 99.5%
Taylor expanded in k around 0 59.4%
associate-*l/59.4%
*-un-lft-identity59.4%
*-commutative59.4%
sqrt-prod59.5%
associate-*r*59.5%
*-commutative59.5%
pow159.5%
sqrt-undiv44.6%
Applied egg-rr44.6%
unpow144.6%
associate-/l*44.6%
associate-/r/44.6%
Simplified44.6%
sqrt-prod59.6%
Applied egg-rr59.6%
if 7.49999999999999964e226 < k Initial program 100.0%
Taylor expanded in k around 0 3.0%
associate-*l/3.0%
*-un-lft-identity3.0%
*-commutative3.0%
sqrt-prod3.0%
associate-*r*3.0%
*-commutative3.0%
pow13.0%
sqrt-undiv3.0%
Applied egg-rr3.0%
unpow13.0%
associate-/l*3.0%
associate-/r/3.0%
Simplified3.0%
pow1/23.0%
*-commutative3.0%
associate-*l*3.0%
div-inv3.0%
associate-*l*3.0%
div-inv3.0%
metadata-eval3.0%
pow-sqr3.0%
pow-prod-down20.3%
*-commutative20.3%
*-commutative20.3%
swap-sqr20.3%
pow220.3%
associate-/l*20.3%
associate-/r/20.3%
metadata-eval20.3%
Applied egg-rr20.3%
*-commutative20.3%
metadata-eval20.3%
unpow220.3%
swap-sqr20.3%
unpow120.3%
unpow120.3%
pow-sqr20.3%
associate-*r*20.3%
*-commutative20.3%
metadata-eval20.3%
Simplified20.3%
Final simplification52.9%
(FPCore (k n) :precision binary64 (if (<= k 1.95e+147) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (pow (pow (* (* 2.0 n) (/ PI k)) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 1.95e+147) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} else {
tmp = pow(pow(((2.0 * n) * (((double) M_PI) / k)), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.95e+147) {
tmp = Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
} else {
tmp = Math.pow(Math.pow(((2.0 * n) * (Math.PI / k)), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.95e+147: tmp = math.sqrt((math.pi / k)) * math.sqrt((2.0 * n)) else: tmp = math.pow(math.pow(((2.0 * n) * (math.pi / k)), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.95e+147) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); else tmp = (Float64(Float64(2.0 * n) * Float64(pi / k)) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.95e+147) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); else tmp = (((2.0 * n) * (pi / k)) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.95e+147], N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(N[(2.0 * n), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.95 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\left(2 \cdot n\right) \cdot \frac{\pi}{k}\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 1.95000000000000008e147Initial program 99.4%
Taylor expanded in k around 0 68.4%
associate-*l/68.4%
*-un-lft-identity68.4%
*-commutative68.4%
sqrt-prod68.5%
associate-*r*68.5%
*-commutative68.5%
pow168.5%
sqrt-undiv51.3%
Applied egg-rr51.3%
unpow151.3%
associate-/l*51.3%
associate-/r/51.3%
Simplified51.3%
sqrt-prod68.7%
Applied egg-rr68.7%
if 1.95000000000000008e147 < k Initial program 100.0%
add-sqr-sqrt100.0%
pow2100.0%
Applied egg-rr100.0%
associate-*r*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 2.8%
sqrt-unprod2.8%
*-commutative2.8%
associate-/l*2.8%
associate-/r/2.8%
Applied egg-rr2.8%
pow1/22.8%
metadata-eval2.8%
pow-pow9.2%
sqr-pow9.2%
pow-prod-down26.4%
pow-sqr26.4%
associate-*l/26.4%
associate-*r/26.4%
metadata-eval26.4%
metadata-eval26.4%
Applied egg-rr26.4%
associate-*r*26.4%
*-commutative26.4%
*-commutative26.4%
Simplified26.4%
Final simplification56.6%
(FPCore (k n) :precision binary64 (if (<= k 3.7e+226) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (cbrt (pow (* 2.0 (* n (/ PI k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 3.7e+226) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} else {
tmp = cbrt(pow((2.0 * (n * (((double) M_PI) / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3.7e+226) {
tmp = Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
} else {
tmp = Math.cbrt(Math.pow((2.0 * (n * (Math.PI / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 3.7e+226) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); else tmp = cbrt((Float64(2.0 * Float64(n * Float64(pi / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 3.7e+226], N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(n * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.7 \cdot 10^{+226}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(n \cdot \frac{\pi}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 3.69999999999999982e226Initial program 99.5%
Taylor expanded in k around 0 59.4%
associate-*l/59.4%
*-un-lft-identity59.4%
*-commutative59.4%
sqrt-prod59.5%
associate-*r*59.5%
*-commutative59.5%
pow159.5%
sqrt-undiv44.6%
Applied egg-rr44.6%
unpow144.6%
associate-/l*44.6%
associate-/r/44.6%
Simplified44.6%
sqrt-prod59.6%
Applied egg-rr59.6%
if 3.69999999999999982e226 < k Initial program 100.0%
Taylor expanded in k around 0 3.0%
associate-*l/3.0%
*-un-lft-identity3.0%
*-commutative3.0%
sqrt-prod3.0%
associate-*r*3.0%
*-commutative3.0%
pow13.0%
sqrt-undiv3.0%
Applied egg-rr3.0%
unpow13.0%
associate-/l*3.0%
associate-/r/3.0%
Simplified3.0%
add-log-exp48.7%
add-cbrt-cube48.7%
add-log-exp48.7%
add-log-exp48.7%
add-sqr-sqrt48.7%
*-commutative48.7%
add-log-exp13.8%
pow1/313.8%
Applied egg-rr13.8%
unpow1/313.8%
associate-*l/13.8%
associate-*r/13.8%
Simplified13.8%
Final simplification51.7%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* PI (/ 2.0 k)))))
double code(double k, double n) {
return sqrt(n) * sqrt((((double) M_PI) * (2.0 / k)));
}
public static double code(double k, double n) {
return Math.sqrt(n) * Math.sqrt((Math.PI * (2.0 / k)));
}
def code(k, n): return math.sqrt(n) * math.sqrt((math.pi * (2.0 / k)))
function code(k, n) return Float64(sqrt(n) * sqrt(Float64(pi * Float64(2.0 / k)))) end
function tmp = code(k, n) tmp = sqrt(n) * sqrt((pi * (2.0 / k))); end
code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 49.7%
associate-*l/49.7%
*-un-lft-identity49.7%
*-commutative49.7%
sqrt-prod49.8%
associate-*r*49.8%
*-commutative49.8%
pow149.8%
sqrt-undiv37.5%
Applied egg-rr37.5%
unpow137.5%
associate-/l*37.5%
associate-/r/37.5%
Simplified37.5%
associate-*r*37.5%
sqrt-prod49.8%
clear-num49.8%
metadata-eval49.8%
associate-*l/49.8%
metadata-eval49.8%
metadata-eval49.8%
Applied egg-rr49.8%
*-commutative49.8%
associate-/r/49.8%
Simplified49.8%
Final simplification49.8%
(FPCore (k n) :precision binary64 (* (sqrt (/ PI k)) (sqrt (* 2.0 n))))
double code(double k, double n) {
return sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
}
def code(k, n): return math.sqrt((math.pi / k)) * math.sqrt((2.0 * n))
function code(k, n) return Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))) end
function tmp = code(k, n) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); end
code[k_, n_] := N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 49.7%
associate-*l/49.7%
*-un-lft-identity49.7%
*-commutative49.7%
sqrt-prod49.8%
associate-*r*49.8%
*-commutative49.8%
pow149.8%
sqrt-undiv37.5%
Applied egg-rr37.5%
unpow137.5%
associate-/l*37.5%
associate-/r/37.5%
Simplified37.5%
sqrt-prod49.9%
Applied egg-rr49.9%
Final simplification49.9%
(FPCore (k n) :precision binary64 (pow (* 0.5 (/ k (* PI n))) -0.5))
double code(double k, double n) {
return pow((0.5 * (k / (((double) M_PI) * n))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((0.5 * (k / (Math.PI * n))), -0.5);
}
def code(k, n): return math.pow((0.5 * (k / (math.pi * n))), -0.5)
function code(k, n) return Float64(0.5 * Float64(k / Float64(pi * n))) ^ -0.5 end
function tmp = code(k, n) tmp = (0.5 * (k / (pi * n))) ^ -0.5; end
code[k_, n_] := N[Power[N[(0.5 * N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(0.5 \cdot \frac{k}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.6%
add-sqr-sqrt99.5%
pow299.5%
Applied egg-rr99.4%
associate-*r*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in k around 0 37.4%
sqrt-unprod37.5%
*-commutative37.5%
associate-/l*37.4%
associate-/r/37.4%
Applied egg-rr37.4%
metadata-eval37.4%
*-commutative37.4%
clear-num37.4%
div-inv37.5%
times-frac37.5%
associate-/l*37.5%
metadata-eval37.5%
add-sqr-sqrt37.4%
frac-times37.4%
sqrt-unprod37.9%
add-sqr-sqrt38.0%
pow1/238.0%
pow-flip38.1%
*-un-lft-identity38.1%
times-frac38.1%
metadata-eval38.1%
metadata-eval38.1%
Applied egg-rr38.1%
associate-/r*38.1%
Simplified38.1%
Final simplification38.1%
(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.6%
add-sqr-sqrt99.5%
pow299.5%
Applied egg-rr99.4%
associate-*r*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in k around 0 37.4%
sqrt-unprod37.5%
*-commutative37.5%
associate-/l*37.4%
associate-/r/37.4%
Applied egg-rr37.4%
Final simplification37.4%
(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(Float64(2.0 * n) * Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * n) * (pi / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * n), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot n\right) \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 49.7%
associate-*l/49.7%
*-un-lft-identity49.7%
*-commutative49.7%
sqrt-prod49.8%
associate-*r*49.8%
*-commutative49.8%
pow149.8%
sqrt-undiv37.5%
Applied egg-rr37.5%
unpow137.5%
associate-/l*37.5%
associate-/r/37.5%
Simplified37.5%
Final simplification37.5%
(FPCore (k n) :precision binary64 (sqrt (/ PI (/ k (* 2.0 n)))))
double code(double k, double n) {
return sqrt((((double) M_PI) / (k / (2.0 * n))));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI / (k / (2.0 * n))));
}
def code(k, n): return math.sqrt((math.pi / (k / (2.0 * n))))
function code(k, n) return sqrt(Float64(pi / Float64(k / Float64(2.0 * n)))) end
function tmp = code(k, n) tmp = sqrt((pi / (k / (2.0 * n)))); end
code[k_, n_] := N[Sqrt[N[(Pi / N[(k / N[(2.0 * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{\frac{k}{2 \cdot n}}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 49.7%
associate-*l/49.7%
*-un-lft-identity49.7%
*-commutative49.7%
sqrt-prod49.8%
associate-*r*49.8%
*-commutative49.8%
pow149.8%
sqrt-undiv37.5%
Applied egg-rr37.5%
unpow137.5%
associate-/l*37.5%
Simplified37.5%
Final simplification37.5%
(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(Float64(pi * Float64(2.0 * n)) / k)) end
function tmp = code(k, n) tmp = sqrt(((pi * (2.0 * n)) / k)); end
code[k_, n_] := N[Sqrt[N[(N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi \cdot \left(2 \cdot n\right)}{k}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 49.7%
associate-*l/49.7%
*-un-lft-identity49.7%
*-commutative49.7%
sqrt-prod49.8%
associate-*r*49.8%
*-commutative49.8%
sqrt-undiv37.5%
Applied egg-rr37.5%
Final simplification37.5%
herbie shell --seed 2023301
(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))))