
(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 11 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 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(Float64(2.0 * pi) * n) return Float64(sqrt(t_0) * Float64((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[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(N[Power[k, -0.5], $MachinePrecision] / N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(2 \cdot \pi\right) \cdot n\\
\sqrt{t\_0} \cdot \frac{{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.6%
metadata-eval99.6%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
*-commutative99.6%
associate-/l*99.6%
associate-*r*99.6%
associate-*r*99.6%
Simplified99.6%
(FPCore (k n) :precision binary64 (let* ((t_0 (* (* 2.0 PI) n))) (/ (sqrt t_0) (* (pow t_0 (* k 0.5)) (sqrt k)))))
double code(double k, double n) {
double t_0 = (2.0 * ((double) M_PI)) * n;
return sqrt(t_0) / (pow(t_0, (k * 0.5)) * sqrt(k));
}
public static double code(double k, double n) {
double t_0 = (2.0 * Math.PI) * n;
return Math.sqrt(t_0) / (Math.pow(t_0, (k * 0.5)) * Math.sqrt(k));
}
def code(k, n): t_0 = (2.0 * math.pi) * n return math.sqrt(t_0) / (math.pow(t_0, (k * 0.5)) * math.sqrt(k))
function code(k, n) t_0 = Float64(Float64(2.0 * pi) * n) return Float64(sqrt(t_0) / Float64((t_0 ^ Float64(k * 0.5)) * sqrt(k))) end
function tmp = code(k, n) t_0 = (2.0 * pi) * n; tmp = sqrt(t_0) / ((t_0 ^ (k * 0.5)) * sqrt(k)); end
code[k_, n_] := Block[{t$95$0 = N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision] * N[Sqrt[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(2 \cdot \pi\right) \cdot n\\
\frac{\sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)} \cdot \sqrt{k}}
\end{array}
\end{array}
Initial program 99.4%
associate-*l/99.4%
*-un-lft-identity99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
pow-div99.6%
pow1/299.6%
associate-/l/99.6%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
associate-*r*99.6%
associate-*r*99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 1.08e-23) (* (sqrt (* PI (/ 2.0 k))) (sqrt n)) (pow (/ k (pow (* (* 2.0 PI) n) (- 1.0 k))) -0.5)))
double code(double k, double n) {
double tmp;
if (k <= 1.08e-23) {
tmp = sqrt((((double) M_PI) * (2.0 / k))) * sqrt(n);
} else {
tmp = pow((k / pow(((2.0 * ((double) M_PI)) * n), (1.0 - k))), -0.5);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.08e-23) {
tmp = Math.sqrt((Math.PI * (2.0 / k))) * Math.sqrt(n);
} else {
tmp = Math.pow((k / Math.pow(((2.0 * Math.PI) * n), (1.0 - k))), -0.5);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.08e-23: tmp = math.sqrt((math.pi * (2.0 / k))) * math.sqrt(n) else: tmp = math.pow((k / math.pow(((2.0 * math.pi) * n), (1.0 - k))), -0.5) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.08e-23) tmp = Float64(sqrt(Float64(pi * Float64(2.0 / k))) * sqrt(n)); else tmp = Float64(k / (Float64(Float64(2.0 * pi) * n) ^ Float64(1.0 - k))) ^ -0.5; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.08e-23) tmp = sqrt((pi * (2.0 / k))) * sqrt(n); else tmp = (k / (((2.0 * pi) * n) ^ (1.0 - k))) ^ -0.5; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.08e-23], N[(N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[Power[N[(k / N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.08 \cdot 10^{-23}:\\
\;\;\;\;\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{k}{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}\right)}^{-0.5}\\
\end{array}
\end{array}
if k < 1.08000000000000003e-23Initial program 99.2%
Taylor expanded in k around 0 78.8%
associate-/l*78.8%
Simplified78.8%
pow178.8%
*-commutative78.8%
sqrt-unprod78.9%
associate-*r/78.9%
*-commutative78.9%
Applied egg-rr78.9%
unpow178.9%
*-commutative78.9%
associate-/l*78.9%
Simplified78.9%
add-cbrt-cube62.1%
pow1/357.8%
add-sqr-sqrt57.8%
pow157.8%
pow1/257.8%
pow-prod-up57.8%
associate-*r/57.8%
*-commutative57.8%
associate-/l*57.8%
metadata-eval57.8%
Applied egg-rr57.8%
unpow1/362.1%
*-commutative62.1%
associate-*r/62.0%
associate-*l/62.1%
*-commutative62.1%
associate-*l*62.1%
Simplified62.1%
pow1/357.8%
pow-pow78.9%
metadata-eval78.9%
pow1/278.9%
*-commutative78.9%
sqrt-prod99.5%
*-commutative99.5%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
associate-/r/99.5%
Simplified99.5%
if 1.08000000000000003e-23 < k Initial program 99.5%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
*-commutative99.5%
Applied egg-rr99.5%
Simplified99.5%
clear-num99.5%
sqrt-div99.5%
metadata-eval99.5%
*-commutative99.5%
associate-*l*99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
inv-pow99.5%
sqrt-pow299.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 1e-23) (* (sqrt (* PI (/ 2.0 k))) (sqrt n)) (sqrt (/ (pow (* (* 2.0 PI) n) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 1e-23) {
tmp = sqrt((((double) M_PI) * (2.0 / k))) * sqrt(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 <= 1e-23) {
tmp = Math.sqrt((Math.PI * (2.0 / k))) * Math.sqrt(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 <= 1e-23: tmp = math.sqrt((math.pi * (2.0 / k))) * math.sqrt(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 <= 1e-23) tmp = Float64(sqrt(Float64(pi * Float64(2.0 / k))) * sqrt(n)); else tmp = sqrt(Float64((Float64(Float64(2.0 * pi) * n) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1e-23) tmp = sqrt((pi * (2.0 / k))) * sqrt(n); else tmp = sqrt(((((2.0 * pi) * n) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1e-23], N[(N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 10^{-23}:\\
\;\;\;\;\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 9.9999999999999996e-24Initial program 99.2%
Taylor expanded in k around 0 78.8%
associate-/l*78.8%
Simplified78.8%
pow178.8%
*-commutative78.8%
sqrt-unprod78.9%
associate-*r/78.9%
*-commutative78.9%
Applied egg-rr78.9%
unpow178.9%
*-commutative78.9%
associate-/l*78.9%
Simplified78.9%
add-cbrt-cube62.1%
pow1/357.8%
add-sqr-sqrt57.8%
pow157.8%
pow1/257.8%
pow-prod-up57.8%
associate-*r/57.8%
*-commutative57.8%
associate-/l*57.8%
metadata-eval57.8%
Applied egg-rr57.8%
unpow1/362.1%
*-commutative62.1%
associate-*r/62.0%
associate-*l/62.1%
*-commutative62.1%
associate-*l*62.1%
Simplified62.1%
pow1/357.8%
pow-pow78.9%
metadata-eval78.9%
pow1/278.9%
*-commutative78.9%
sqrt-prod99.5%
*-commutative99.5%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
associate-/r/99.5%
Simplified99.5%
if 9.9999999999999996e-24 < k Initial program 99.5%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
*-commutative99.5%
Applied egg-rr99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 1.02e+79) (* (sqrt (* PI (/ 2.0 k))) (sqrt n)) (sqrt (* 2.0 (+ -1.0 (fma n (/ PI k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 1.02e+79) {
tmp = sqrt((((double) M_PI) * (2.0 / k))) * sqrt(n);
} else {
tmp = sqrt((2.0 * (-1.0 + fma(n, (((double) M_PI) / k), 1.0))));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.02e+79) tmp = Float64(sqrt(Float64(pi * Float64(2.0 / k))) * sqrt(n)); else tmp = sqrt(Float64(2.0 * Float64(-1.0 + fma(n, Float64(pi / k), 1.0)))); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.02e+79], N[(N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(-1.0 + N[(n * N[(Pi / k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.02 \cdot 10^{+79}:\\
\;\;\;\;\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 1.02000000000000006e79Initial program 99.1%
Taylor expanded in k around 0 63.5%
associate-/l*63.5%
Simplified63.5%
pow163.5%
*-commutative63.5%
sqrt-unprod63.6%
associate-*r/63.5%
*-commutative63.5%
Applied egg-rr63.5%
unpow163.5%
*-commutative63.5%
associate-/l*63.6%
Simplified63.6%
add-cbrt-cube50.9%
pow1/347.7%
add-sqr-sqrt47.7%
pow147.7%
pow1/247.7%
pow-prod-up47.7%
associate-*r/47.7%
*-commutative47.7%
associate-/l*47.7%
metadata-eval47.7%
Applied egg-rr47.7%
unpow1/351.0%
*-commutative51.0%
associate-*r/50.9%
associate-*l/51.0%
*-commutative51.0%
associate-*l*51.0%
Simplified51.0%
pow1/347.7%
pow-pow63.6%
metadata-eval63.6%
pow1/263.6%
*-commutative63.6%
sqrt-prod78.3%
*-commutative78.3%
clear-num78.3%
un-div-inv78.3%
Applied egg-rr78.3%
associate-/r/78.3%
Simplified78.3%
if 1.02000000000000006e79 < k Initial program 100.0%
Taylor expanded in k around 0 2.5%
associate-/l*2.5%
Simplified2.5%
pow12.5%
*-commutative2.5%
sqrt-unprod2.5%
associate-*r/2.5%
*-commutative2.5%
Applied egg-rr2.5%
unpow12.5%
*-commutative2.5%
associate-/l*2.5%
Simplified2.5%
associate-*r/2.5%
expm1-log1p-u2.5%
expm1-undefine20.2%
*-commutative20.2%
associate-/l*20.2%
Applied egg-rr20.2%
sub-neg20.2%
metadata-eval20.2%
+-commutative20.2%
log1p-undefine20.2%
rem-exp-log20.2%
+-commutative20.2%
associate-*r/20.2%
associate-*l/20.2%
*-commutative20.2%
fma-define20.2%
Simplified20.2%
Final simplification58.8%
(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.4%
*-lft-identity99.4%
associate-*l*99.4%
div-sub99.4%
metadata-eval99.4%
Simplified99.4%
div-inv99.4%
div-inv99.4%
metadata-eval99.4%
pow1/299.4%
pow-flip99.4%
metadata-eval99.4%
Applied egg-rr99.4%
Final simplification99.4%
(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.4%
*-lft-identity99.4%
associate-*l*99.4%
div-sub99.4%
metadata-eval99.4%
Simplified99.4%
(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 43.0%
associate-/l*43.0%
Simplified43.0%
pow143.0%
*-commutative43.0%
sqrt-unprod43.0%
associate-*r/43.0%
*-commutative43.0%
Applied egg-rr43.0%
unpow143.0%
*-commutative43.0%
associate-/l*43.0%
Simplified43.0%
add-cbrt-cube35.4%
pow1/333.2%
add-sqr-sqrt33.2%
pow133.2%
pow1/233.2%
pow-prod-up33.2%
associate-*r/33.2%
*-commutative33.2%
associate-/l*33.2%
metadata-eval33.2%
Applied egg-rr33.2%
unpow1/335.4%
*-commutative35.4%
associate-*r/35.4%
associate-*l/35.4%
*-commutative35.4%
associate-*l*35.4%
Simplified35.4%
pow1/333.2%
pow-pow43.0%
metadata-eval43.0%
pow1/243.0%
*-commutative43.0%
sqrt-prod52.9%
*-commutative52.9%
clear-num52.9%
un-div-inv52.9%
Applied egg-rr52.9%
associate-/r/52.9%
Simplified52.9%
Final simplification52.9%
(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 43.0%
associate-/l*43.0%
Simplified43.0%
pow143.0%
*-commutative43.0%
sqrt-unprod43.0%
associate-*r/43.0%
*-commutative43.0%
Applied egg-rr43.0%
unpow143.0%
*-commutative43.0%
associate-/l*43.0%
Simplified43.0%
pow1/243.0%
associate-*r*43.0%
unpow-prod-down52.8%
pow1/252.8%
Applied egg-rr52.8%
unpow1/252.8%
*-commutative52.8%
Simplified52.8%
Final simplification52.8%
(FPCore (k n) :precision binary64 (pow (* (/ k PI) (/ 0.5 n)) -0.5))
double code(double k, double n) {
return pow(((k / ((double) M_PI)) * (0.5 / n)), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k / Math.PI) * (0.5 / n)), -0.5);
}
def code(k, n): return math.pow(((k / math.pi) * (0.5 / n)), -0.5)
function code(k, n) return Float64(Float64(k / pi) * Float64(0.5 / n)) ^ -0.5 end
function tmp = code(k, n) tmp = ((k / pi) * (0.5 / n)) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k / Pi), $MachinePrecision] * N[(0.5 / n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{\pi} \cdot \frac{0.5}{n}\right)}^{-0.5}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 43.0%
associate-/l*43.0%
Simplified43.0%
pow143.0%
*-commutative43.0%
sqrt-unprod43.0%
associate-*r/43.0%
*-commutative43.0%
Applied egg-rr43.0%
unpow143.0%
*-commutative43.0%
associate-/l*43.0%
Simplified43.0%
associate-*r/43.0%
associate-*r/43.0%
*-commutative43.0%
sqrt-undiv52.8%
clear-num52.7%
frac-2neg52.7%
metadata-eval52.7%
div-inv52.7%
sqrt-undiv43.9%
Applied egg-rr43.9%
mul-1-neg43.9%
distribute-frac-neg243.9%
remove-double-neg43.9%
associate-/r*43.9%
*-commutative43.9%
Simplified43.9%
pow1/243.9%
pow-flip44.0%
div-inv44.0%
metadata-eval44.0%
*-commutative44.0%
times-frac44.0%
metadata-eval44.0%
Applied egg-rr44.0%
(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 43.0%
associate-/l*43.0%
Simplified43.0%
pow143.0%
*-commutative43.0%
sqrt-unprod43.0%
associate-*r/43.0%
*-commutative43.0%
Applied egg-rr43.0%
unpow143.0%
*-commutative43.0%
associate-/l*43.0%
Simplified43.0%
herbie shell --seed 2024093
(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))))