
(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 (* PI (* 2.0 n)))) (* (/ (sqrt t_0) (pow t_0 (* 0.5 k))) (pow k -0.5))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return (sqrt(t_0) / pow(t_0, (0.5 * k))) * pow(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.pow(t_0, (0.5 * k))) * Math.pow(k, -0.5);
}
def code(k, n): t_0 = math.pi * (2.0 * n) return (math.sqrt(t_0) / math.pow(t_0, (0.5 * k))) * math.pow(k, -0.5)
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(Float64(sqrt(t_0) / (t_0 ^ Float64(0.5 * k))) * (k ^ -0.5)) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = (sqrt(t_0) / (t_0 ^ (0.5 * k))) * (k ^ -0.5); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Power[t$95$0, N[(0.5 * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\frac{\sqrt{t\_0}}{{t\_0}^{\left(0.5 \cdot k\right)}} \cdot {k}^{-0.5}
\end{array}
\end{array}
Initial program 99.3%
*-commutative99.3%
associate-*r*99.3%
div-sub99.3%
metadata-eval99.3%
pow-sub99.6%
pow1/299.6%
associate-*r/99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Applied egg-rr99.7%
*-commutative99.7%
associate-/l*99.6%
associate-/r/99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* 2.0 n)))) (/ (sqrt t_0) (* (pow t_0 (* 0.5 k)) (sqrt k)))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return sqrt(t_0) / (pow(t_0, (0.5 * k)) * sqrt(k));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
return Math.sqrt(t_0) / (Math.pow(t_0, (0.5 * k)) * Math.sqrt(k));
}
def code(k, n): t_0 = math.pi * (2.0 * n) return math.sqrt(t_0) / (math.pow(t_0, (0.5 * k)) * math.sqrt(k))
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(sqrt(t_0) / Float64((t_0 ^ Float64(0.5 * k)) * sqrt(k))) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = sqrt(t_0) / ((t_0 ^ (0.5 * k)) * sqrt(k)); 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[Power[t$95$0, N[(0.5 * k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\frac{\sqrt{t\_0}}{{t\_0}^{\left(0.5 \cdot k\right)} \cdot \sqrt{k}}
\end{array}
\end{array}
Initial program 99.3%
associate-/r/99.3%
*-commutative99.3%
associate-*r*99.3%
div-sub99.3%
metadata-eval99.3%
clear-num99.4%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 3.1e-17) (* (sqrt (* 2.0 (/ PI k))) (sqrt n)) (/ 1.0 (sqrt (/ k (pow (* PI (* 2.0 n)) (- 1.0 k)))))))
double code(double k, double n) {
double tmp;
if (k <= 3.1e-17) {
tmp = sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
} else {
tmp = 1.0 / sqrt((k / pow((((double) M_PI) * (2.0 * n)), (1.0 - k))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3.1e-17) {
tmp = Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(n);
} else {
tmp = 1.0 / Math.sqrt((k / Math.pow((Math.PI * (2.0 * n)), (1.0 - k))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 3.1e-17: tmp = math.sqrt((2.0 * (math.pi / k))) * math.sqrt(n) else: tmp = 1.0 / math.sqrt((k / math.pow((math.pi * (2.0 * n)), (1.0 - k)))) return tmp
function code(k, n) tmp = 0.0 if (k <= 3.1e-17) tmp = Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)); else tmp = Float64(1.0 / sqrt(Float64(k / (Float64(pi * Float64(2.0 * n)) ^ Float64(1.0 - k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 3.1e-17) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); else tmp = 1.0 / sqrt((k / ((pi * (2.0 * n)) ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 3.1e-17], N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k / N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.1 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 3.0999999999999998e-17Initial program 99.2%
Taylor expanded in k around 0 99.1%
expm1-log1p-u93.1%
expm1-udef75.5%
associate-*l/75.5%
*-un-lft-identity75.5%
sqrt-unprod75.5%
*-commutative75.5%
*-commutative75.5%
sqrt-undiv48.6%
associate-*r*48.6%
Applied egg-rr48.6%
expm1-def66.3%
expm1-log1p69.7%
associate-/l*69.7%
associate-/r/69.7%
Simplified69.7%
sqrt-prod99.5%
*-un-lft-identity99.5%
times-frac99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 3.0999999999999998e-17 < k Initial program 99.4%
*-commutative99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
pow-sub99.9%
pow1/299.9%
associate-*r/99.9%
pow1/299.9%
pow-flip99.9%
metadata-eval99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
Applied egg-rr99.9%
*-commutative99.9%
associate-/l*99.9%
associate-/r/99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
Applied egg-rr99.4%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 6.5e-17) (* (sqrt (* 2.0 (/ PI k))) (sqrt n)) (sqrt (/ (pow (* PI (* 2.0 n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 6.5e-17) {
tmp = sqrt((2.0 * (((double) M_PI) / k))) * sqrt(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.5e-17) {
tmp = Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(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.5e-17: tmp = math.sqrt((2.0 * (math.pi / k))) * math.sqrt(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.5e-17) tmp = Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(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.5e-17) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); else tmp = sqrt((((pi * (2.0 * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 6.5e-17], N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $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.5 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{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.4999999999999996e-17Initial program 99.2%
Taylor expanded in k around 0 99.1%
expm1-log1p-u93.1%
expm1-udef75.5%
associate-*l/75.5%
*-un-lft-identity75.5%
sqrt-unprod75.5%
*-commutative75.5%
*-commutative75.5%
sqrt-undiv48.6%
associate-*r*48.6%
Applied egg-rr48.6%
expm1-def66.3%
expm1-log1p69.7%
associate-/l*69.7%
associate-/r/69.7%
Simplified69.7%
sqrt-prod99.5%
*-un-lft-identity99.5%
times-frac99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 6.4999999999999996e-17 < k Initial program 99.4%
add-sqr-sqrt99.4%
sqrt-unprod99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-sub99.4%
metadata-eval99.4%
div-inv99.4%
*-commutative99.4%
Applied egg-rr99.4%
Simplified99.4%
Final simplification99.5%
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (pow (* n (* PI 2.0)) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return sqrt((1.0 / k)) * pow((n * (((double) M_PI) * 2.0)), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / k)) * Math.pow((n * (Math.PI * 2.0)), ((1.0 - k) / 2.0));
}
def code(k, n): return math.sqrt((1.0 / k)) * math.pow((n * (math.pi * 2.0)), ((1.0 - k) / 2.0))
function code(k, n) return Float64(sqrt(Float64(1.0 / k)) * (Float64(n * Float64(pi * 2.0)) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)) * ((n * (pi * 2.0)) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $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}
\\
\sqrt{\frac{1}{k}} \cdot {\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.3%
add-sqr-sqrt99.2%
sqrt-unprod99.3%
frac-times99.3%
metadata-eval99.3%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (- 0.5 (* 0.5 k)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), (0.5 - (0.5 * k)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), (0.5 - (0.5 * k)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), (0.5 - (0.5 * k)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 - Float64(0.5 * k)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ (0.5 - (0.5 * k))); 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[(0.5 * k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - 0.5 \cdot k\right)}
\end{array}
Initial program 99.3%
associate-*l/99.4%
*-lft-identity99.4%
sqr-pow99.3%
pow-sqr99.4%
*-commutative99.4%
associate-*l*99.4%
associate-*r/99.4%
*-commutative99.4%
associate-/l*99.4%
metadata-eval99.4%
/-rgt-identity99.4%
div-sub99.4%
metadata-eval99.4%
Simplified99.4%
div-inv99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*l*99.3%
div-inv99.3%
metadata-eval99.3%
pow1/299.3%
pow-flip99.4%
metadata-eval99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.3%
associate-*l/99.4%
*-lft-identity99.4%
sqr-pow99.3%
pow-sqr99.4%
*-commutative99.4%
associate-*l*99.4%
associate-*r/99.4%
*-commutative99.4%
associate-/l*99.4%
metadata-eval99.4%
/-rgt-identity99.4%
div-sub99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 (/ PI k))) (sqrt n)))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(n);
}
def code(k, n): return math.sqrt((2.0 * (math.pi / k))) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 47.3%
expm1-log1p-u44.6%
expm1-udef45.0%
associate-*l/45.0%
*-un-lft-identity45.0%
sqrt-unprod45.0%
*-commutative45.0%
*-commutative45.0%
sqrt-undiv33.1%
associate-*r*33.1%
Applied egg-rr33.1%
expm1-def32.8%
expm1-log1p34.3%
associate-/l*34.3%
associate-/r/34.3%
Simplified34.3%
sqrt-prod47.5%
*-un-lft-identity47.5%
times-frac47.5%
metadata-eval47.5%
Applied egg-rr47.5%
Final simplification47.5%
(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(Float64(0.5 * 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[(N[(0.5 * k), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{0.5 \cdot k}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 47.3%
expm1-log1p-u44.6%
expm1-udef45.0%
associate-*l/45.0%
*-un-lft-identity45.0%
sqrt-unprod45.0%
*-commutative45.0%
*-commutative45.0%
sqrt-undiv33.1%
associate-*r*33.1%
Applied egg-rr33.1%
expm1-def32.8%
expm1-log1p34.3%
associate-/l*34.3%
associate-/r/34.3%
Simplified34.3%
Taylor expanded in k around 0 34.3%
associate-/l*34.3%
associate-/r/34.3%
Simplified34.3%
metadata-eval34.3%
associate-*l/34.3%
*-commutative34.3%
times-frac34.3%
associate-*r*34.3%
*-un-lft-identity34.3%
div-inv34.2%
sqrt-unprod47.4%
*-commutative47.4%
sqrt-prod34.2%
associate-/r/34.2%
inv-pow34.2%
sqrt-pow134.7%
*-un-lft-identity34.7%
associate-*r*34.7%
times-frac34.6%
metadata-eval34.6%
metadata-eval34.6%
Applied egg-rr34.6%
associate-*r/34.7%
*-commutative34.7%
*-commutative34.7%
Simplified34.7%
Final simplification34.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.3%
Taylor expanded in k around 0 47.3%
expm1-log1p-u44.6%
expm1-udef45.0%
associate-*l/45.0%
*-un-lft-identity45.0%
sqrt-unprod45.0%
*-commutative45.0%
*-commutative45.0%
sqrt-undiv33.1%
associate-*r*33.1%
Applied egg-rr33.1%
expm1-def32.8%
expm1-log1p34.3%
associate-/l*34.3%
associate-/r/34.3%
Simplified34.3%
Taylor expanded in k around 0 34.3%
associate-/l*34.3%
associate-/r/34.3%
Simplified34.3%
Final simplification34.3%
(FPCore (k n) :precision binary64 (sqrt (* PI (/ n (* 0.5 k)))))
double code(double k, double n) {
return sqrt((((double) M_PI) * (n / (0.5 * k))));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (n / (0.5 * k))));
}
def code(k, n): return math.sqrt((math.pi * (n / (0.5 * k))))
function code(k, n) return sqrt(Float64(pi * Float64(n / Float64(0.5 * k)))) end
function tmp = code(k, n) tmp = sqrt((pi * (n / (0.5 * k)))); end
code[k_, n_] := N[Sqrt[N[(Pi * N[(n / N[(0.5 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \frac{n}{0.5 \cdot k}}
\end{array}
Initial program 99.3%
Taylor expanded in k around 0 47.3%
expm1-log1p-u44.6%
expm1-udef45.0%
associate-*l/45.0%
*-un-lft-identity45.0%
sqrt-unprod45.0%
*-commutative45.0%
*-commutative45.0%
sqrt-undiv33.1%
associate-*r*33.1%
Applied egg-rr33.1%
expm1-def32.8%
expm1-log1p34.3%
associate-/l*34.3%
associate-/r/34.3%
Simplified34.3%
*-commutative34.3%
clear-num34.3%
un-div-inv34.3%
*-un-lft-identity34.3%
times-frac34.3%
metadata-eval34.3%
Applied egg-rr34.3%
associate-*r/34.3%
associate-/r/34.3%
*-commutative34.3%
Simplified34.3%
Final simplification34.3%
herbie shell --seed 2024040
(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))))