
(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 16 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)))) (* (pow k -0.5) (/ (sqrt t_0) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (n * 2.0);
return pow(k, -0.5) * (sqrt(t_0) / pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (n * 2.0);
return Math.pow(k, -0.5) * (Math.sqrt(t_0) / Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = math.pi * (n * 2.0) return math.pow(k, -0.5) * (math.sqrt(t_0) / math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) return Float64((k ^ -0.5) * Float64(sqrt(t_0) / (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = pi * (n * 2.0); tmp = (k ^ -0.5) * (sqrt(t_0) / (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[k, -0.5], $MachinePrecision] * N[(N[Sqrt[t$95$0], $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(n \cdot 2\right)\\
{k}^{-0.5} \cdot \frac{\sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.7%
pow1/299.7%
associate-*r/99.7%
pow1/299.7%
pow-flip99.7%
metadata-eval99.7%
associate-*l*99.7%
associate-*l*99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-/l*99.7%
*-rgt-identity99.7%
associate-*l*99.7%
*-lft-identity99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* n 2.0)))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (* k 0.5))))))
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 * 0.5)));
}
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 * 0.5)));
}
def code(k, n): t_0 = math.pi * (n * 2.0) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = pi * (n * 2.0); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $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(n \cdot 2\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k} \cdot {t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-un-lft-identity99.5%
unpow-prod-down72.3%
unpow-prod-down99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.7%
pow1/299.7%
associate-/l/99.7%
associate-*l*99.7%
associate-*l*99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(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.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
pow-sub87.4%
pow187.4%
Applied egg-rr87.4%
associate-/l/87.4%
*-commutative87.4%
*-commutative87.4%
sqrt-div99.7%
associate-*r*99.7%
associate-*r*99.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* n 2.0))))
(if (<= k 5.5e-66)
(/ (sqrt t_0) (sqrt k))
(/ 1.0 (sqrt (/ k (pow t_0 (- 1.0 k))))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (n * 2.0);
double tmp;
if (k <= 5.5e-66) {
tmp = sqrt(t_0) / sqrt(k);
} else {
tmp = 1.0 / sqrt((k / pow(t_0, (1.0 - k))));
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = Math.PI * (n * 2.0);
double tmp;
if (k <= 5.5e-66) {
tmp = Math.sqrt(t_0) / Math.sqrt(k);
} else {
tmp = 1.0 / Math.sqrt((k / Math.pow(t_0, (1.0 - k))));
}
return tmp;
}
def code(k, n): t_0 = math.pi * (n * 2.0) tmp = 0 if k <= 5.5e-66: tmp = math.sqrt(t_0) / math.sqrt(k) else: tmp = 1.0 / math.sqrt((k / math.pow(t_0, (1.0 - k)))) return tmp
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) tmp = 0.0 if (k <= 5.5e-66) tmp = Float64(sqrt(t_0) / sqrt(k)); else tmp = Float64(1.0 / sqrt(Float64(k / (t_0 ^ Float64(1.0 - k))))); end return tmp end
function tmp_2 = code(k, n) t_0 = pi * (n * 2.0); tmp = 0.0; if (k <= 5.5e-66) tmp = sqrt(t_0) / sqrt(k); else tmp = 1.0 / sqrt((k / (t_0 ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 5.5e-66], N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k / N[Power[t$95$0, N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(n \cdot 2\right)\\
\mathbf{if}\;k \leq 5.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\sqrt{t\_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{{t\_0}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 5.50000000000000053e-66Initial program 99.4%
associate-/r/99.3%
associate-*l*99.3%
div-sub99.3%
metadata-eval99.3%
sub-neg99.3%
div-inv99.3%
metadata-eval99.3%
distribute-rgt-neg-in99.3%
metadata-eval99.3%
Applied egg-rr99.3%
Taylor expanded in k around 0 99.4%
clear-num99.4%
add-sqr-sqrt99.1%
*-un-lft-identity99.1%
times-frac99.1%
sqrt-unprod99.3%
*-commutative99.3%
associate-*r*99.3%
*-commutative99.3%
pow1/299.3%
sqrt-pow199.3%
*-commutative99.3%
associate-*r*99.3%
*-commutative99.3%
metadata-eval99.3%
Applied egg-rr99.2%
/-rgt-identity99.2%
associate-*r/99.2%
pow-sqr99.5%
metadata-eval99.5%
unpow1/299.5%
*-commutative99.5%
associate-*r*99.5%
Simplified99.5%
if 5.50000000000000053e-66 < k Initial program 99.5%
add-sqr-sqrt99.5%
sqrt-unprod99.0%
*-commutative99.0%
div-sub99.0%
metadata-eval99.0%
div-inv99.0%
*-commutative99.0%
div-sub99.0%
metadata-eval99.0%
div-inv99.0%
Applied egg-rr99.0%
*-commutative99.0%
associate-*l*99.0%
distribute-lft-in99.0%
metadata-eval99.0%
*-commutative99.0%
associate-*r*99.0%
metadata-eval99.0%
mul-1-neg99.0%
sub-neg99.0%
Simplified99.0%
clear-num99.0%
sqrt-div99.3%
metadata-eval99.3%
Applied egg-rr99.3%
Final simplification99.4%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* n 2.0))))
(if (<= k 5.5e-66)
(/ (sqrt t_0) (sqrt k))
(sqrt (/ (pow t_0 (- 1.0 k)) k)))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (n * 2.0);
double tmp;
if (k <= 5.5e-66) {
tmp = sqrt(t_0) / sqrt(k);
} else {
tmp = sqrt((pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = Math.PI * (n * 2.0);
double tmp;
if (k <= 5.5e-66) {
tmp = Math.sqrt(t_0) / Math.sqrt(k);
} else {
tmp = Math.sqrt((Math.pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): t_0 = math.pi * (n * 2.0) tmp = 0 if k <= 5.5e-66: tmp = math.sqrt(t_0) / math.sqrt(k) else: tmp = math.sqrt((math.pow(t_0, (1.0 - k)) / k)) return tmp
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) tmp = 0.0 if (k <= 5.5e-66) tmp = Float64(sqrt(t_0) / sqrt(k)); else tmp = sqrt(Float64((t_0 ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) t_0 = pi * (n * 2.0); tmp = 0.0; if (k <= 5.5e-66) tmp = sqrt(t_0) / sqrt(k); else tmp = sqrt(((t_0 ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 5.5e-66], N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[t$95$0, N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(n \cdot 2\right)\\
\mathbf{if}\;k \leq 5.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\sqrt{t\_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t\_0}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 5.50000000000000053e-66Initial program 99.4%
associate-/r/99.3%
associate-*l*99.3%
div-sub99.3%
metadata-eval99.3%
sub-neg99.3%
div-inv99.3%
metadata-eval99.3%
distribute-rgt-neg-in99.3%
metadata-eval99.3%
Applied egg-rr99.3%
Taylor expanded in k around 0 99.4%
clear-num99.4%
add-sqr-sqrt99.1%
*-un-lft-identity99.1%
times-frac99.1%
sqrt-unprod99.3%
*-commutative99.3%
associate-*r*99.3%
*-commutative99.3%
pow1/299.3%
sqrt-pow199.3%
*-commutative99.3%
associate-*r*99.3%
*-commutative99.3%
metadata-eval99.3%
Applied egg-rr99.2%
/-rgt-identity99.2%
associate-*r/99.2%
pow-sqr99.5%
metadata-eval99.5%
unpow1/299.5%
*-commutative99.5%
associate-*r*99.5%
Simplified99.5%
if 5.50000000000000053e-66 < k Initial program 99.5%
add-sqr-sqrt99.5%
sqrt-unprod99.0%
*-commutative99.0%
div-sub99.0%
metadata-eval99.0%
div-inv99.0%
*-commutative99.0%
div-sub99.0%
metadata-eval99.0%
div-inv99.0%
Applied egg-rr99.0%
*-commutative99.0%
associate-*l*99.0%
distribute-lft-in99.0%
metadata-eval99.0%
*-commutative99.0%
associate-*r*99.0%
metadata-eval99.0%
mul-1-neg99.0%
sub-neg99.0%
Simplified99.0%
Final simplification99.2%
(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.5%
associate-*l/99.5%
*-lft-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
div-inv99.5%
metadata-eval99.5%
div-sub99.5%
unpow-prod-down72.3%
unpow-prod-down99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
sub-neg99.5%
div-inv99.5%
metadata-eval99.5%
distribute-rgt-neg-in99.5%
metadata-eval99.5%
pow1/299.5%
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.5%
associate-*l/99.5%
*-lft-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (sqrt (* 2.0 (* PI n)))))
double code(double k, double n) {
return pow(k, -0.5) * sqrt((2.0 * (((double) M_PI) * n)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.sqrt((2.0 * (Math.PI * n)));
}
def code(k, n): return math.pow(k, -0.5) * math.sqrt((2.0 * (math.pi * n)))
function code(k, n) return Float64((k ^ -0.5) * sqrt(Float64(2.0 * Float64(pi * n)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * sqrt((2.0 * (pi * n))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot \sqrt{2 \cdot \left(\pi \cdot n\right)}
\end{array}
Initial program 99.5%
associate-/r/99.4%
associate-*l*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%
Applied egg-rr99.4%
Taylor expanded in k around 0 47.9%
associate-/r/47.9%
pow1/247.9%
pow-flip47.9%
metadata-eval47.9%
sqrt-unprod48.0%
*-commutative48.0%
*-commutative48.0%
Applied egg-rr48.0%
Final simplification48.0%
(FPCore (k n) :precision binary64 (* (sqrt (/ PI k)) (sqrt (* n 2.0))))
double code(double k, double n) {
return sqrt((((double) M_PI) / k)) * sqrt((n * 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI / k)) * Math.sqrt((n * 2.0));
}
def code(k, n): return math.sqrt((math.pi / k)) * math.sqrt((n * 2.0))
function code(k, n) return Float64(sqrt(Float64(pi / k)) * sqrt(Float64(n * 2.0))) end
function tmp = code(k, n) tmp = sqrt((pi / k)) * sqrt((n * 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(n * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{k}} \cdot \sqrt{n \cdot 2}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
pow-sub87.4%
pow187.4%
Applied egg-rr87.4%
Taylor expanded in k around 0 35.7%
associate-/l*35.7%
Simplified35.7%
associate-*r*35.7%
sqrt-prod48.0%
Applied egg-rr48.0%
*-commutative48.0%
Simplified48.0%
Final simplification48.0%
(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.5%
associate-/r/99.4%
associate-*l*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%
Applied egg-rr99.4%
Taylor expanded in k around 0 47.9%
clear-num47.9%
add-sqr-sqrt47.8%
*-un-lft-identity47.8%
times-frac47.8%
sqrt-unprod47.9%
*-commutative47.9%
associate-*r*47.9%
*-commutative47.9%
pow1/247.9%
sqrt-pow147.9%
*-commutative47.9%
associate-*r*47.9%
*-commutative47.9%
metadata-eval47.9%
Applied egg-rr47.9%
/-rgt-identity47.9%
associate-*r/47.8%
pow-sqr48.0%
metadata-eval48.0%
unpow1/248.0%
*-commutative48.0%
associate-*r*48.0%
Simplified48.0%
Final simplification48.0%
(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.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
clear-num87.1%
sqrt-div87.8%
metadata-eval87.8%
Applied egg-rr87.8%
inv-pow87.8%
sqrt-pow287.9%
associate-*r*87.9%
*-commutative87.9%
*-commutative87.9%
sub-neg87.9%
add-sqr-sqrt0.0%
sqrt-unprod35.9%
sqr-neg35.9%
sqrt-unprod35.9%
add-sqr-sqrt35.9%
metadata-eval35.9%
Applied egg-rr35.9%
associate-*r*35.9%
*-commutative35.9%
+-commutative35.9%
Simplified35.9%
Taylor expanded in k around 0 36.4%
Final simplification36.4%
(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(Float64(k / 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[(N[(k / Pi), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(0.5 \cdot \frac{\frac{k}{\pi}}{n}\right)}^{-0.5}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
clear-num87.1%
sqrt-div87.8%
metadata-eval87.8%
Applied egg-rr87.8%
inv-pow87.8%
sqrt-pow287.9%
associate-*r*87.9%
*-commutative87.9%
*-commutative87.9%
sub-neg87.9%
add-sqr-sqrt0.0%
sqrt-unprod35.9%
sqr-neg35.9%
sqrt-unprod35.9%
add-sqr-sqrt35.9%
metadata-eval35.9%
Applied egg-rr35.9%
associate-*r*35.9%
*-commutative35.9%
+-commutative35.9%
Simplified35.9%
Taylor expanded in k around 0 36.4%
*-commutative36.4%
associate-/r*36.5%
Simplified36.5%
Final simplification36.5%
(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.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
pow-sub87.4%
pow187.4%
Applied egg-rr87.4%
Taylor expanded in k around 0 35.7%
associate-/l*35.7%
Simplified35.7%
Final simplification35.7%
(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.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
pow-sub87.4%
pow187.4%
Applied egg-rr87.4%
Taylor expanded in k around 0 35.7%
associate-*r/35.7%
associate-*r*35.7%
associate-*l/35.7%
associate-/l*35.7%
associate-*l*35.7%
Simplified35.7%
Final simplification35.7%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ n (/ k PI)))))
double code(double k, double n) {
return sqrt((2.0 * (n / (k / ((double) M_PI)))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (n / (k / Math.PI))));
}
def code(k, n): return math.sqrt((2.0 * (n / (k / math.pi))))
function code(k, n) return sqrt(Float64(2.0 * Float64(n / Float64(k / pi)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (n / (k / pi)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n / N[(k / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{n}{\frac{k}{\pi}}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
pow-sub87.4%
pow187.4%
Applied egg-rr87.4%
Taylor expanded in k around 0 35.7%
associate-/l*35.7%
Simplified35.7%
clear-num35.7%
un-div-inv35.7%
Applied egg-rr35.7%
Final simplification35.7%
(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.5%
add-sqr-sqrt99.3%
sqrt-unprod87.0%
*-commutative87.0%
div-sub87.0%
metadata-eval87.0%
div-inv87.1%
*-commutative87.1%
div-sub87.1%
metadata-eval87.1%
div-inv87.1%
Applied egg-rr87.2%
*-commutative87.2%
associate-*l*87.2%
distribute-lft-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.2%
metadata-eval87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
pow-sub87.4%
pow187.4%
Applied egg-rr87.4%
Taylor expanded in k around 0 35.7%
Final simplification35.7%
herbie shell --seed 2024039
(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))))