
(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 12 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) (* (sqrt k) (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) / (sqrt(k) * 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.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * 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 := 2 \cdot \left(\pi \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.4%
associate-*l/99.5%
*-un-lft-identity99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.5%
pow1/299.5%
associate-/l/99.5%
div-inv99.5%
metadata-eval99.5%
Applied egg-rr99.5%
(FPCore (k n) :precision binary64 (if (<= k 1.25e-22) (* (sqrt n) (sqrt (* PI (/ 2.0 k)))) (sqrt (* (/ 1.0 k) (pow (* PI (* 2.0 n)) (- 1.0 k))))))
double code(double k, double n) {
double tmp;
if (k <= 1.25e-22) {
tmp = sqrt(n) * sqrt((((double) M_PI) * (2.0 / k)));
} else {
tmp = sqrt(((1.0 / 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 <= 1.25e-22) {
tmp = Math.sqrt(n) * Math.sqrt((Math.PI * (2.0 / k)));
} else {
tmp = Math.sqrt(((1.0 / k) * Math.pow((Math.PI * (2.0 * n)), (1.0 - k))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.25e-22: tmp = math.sqrt(n) * math.sqrt((math.pi * (2.0 / k))) else: tmp = math.sqrt(((1.0 / k) * math.pow((math.pi * (2.0 * n)), (1.0 - k)))) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.25e-22) tmp = Float64(sqrt(n) * sqrt(Float64(pi * Float64(2.0 / k)))); else tmp = sqrt(Float64(Float64(1.0 / 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 <= 1.25e-22) tmp = sqrt(n) * sqrt((pi * (2.0 / k))); else tmp = sqrt(((1.0 / k) * ((pi * (2.0 * n)) ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.25e-22], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(1.0 / k), $MachinePrecision] * N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.25 \cdot 10^{-22}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{k} \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}\\
\end{array}
\end{array}
if k < 1.24999999999999988e-22Initial program 99.3%
Taylor expanded in k around 0 72.7%
associate-/l*72.7%
Simplified72.7%
sqrt-unprod72.8%
Applied egg-rr72.8%
pow1/272.8%
associate-*l*72.8%
unpow-prod-down99.5%
pow1/299.5%
Applied egg-rr99.5%
unpow1/299.5%
associate-*l/99.5%
associate-/l*99.5%
Simplified99.5%
if 1.24999999999999988e-22 < k Initial program 99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
pow-div99.6%
pow1/299.6%
associate-/l/99.6%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
*-un-lft-identity99.6%
frac-times99.6%
pow1/299.6%
metadata-eval99.6%
pow-pow99.6%
pow1/299.6%
metadata-eval99.6%
div-inv99.6%
pow-sub99.6%
associate-*r*99.6%
metadata-eval99.6%
div-sub99.6%
*-commutative99.6%
Applied egg-rr99.6%
*-commutative99.6%
*-commutative99.6%
Simplified99.6%
add-sqr-sqrt99.6%
sqrt-unprod98.9%
pow298.9%
Applied egg-rr98.9%
unpow298.9%
*-commutative98.9%
*-commutative98.9%
swap-sqr98.9%
pow-sqr98.9%
metadata-eval98.9%
unpow-198.9%
rem-square-sqrt98.9%
*-commutative98.9%
associate-*l*98.9%
Simplified98.9%
(FPCore (k n) :precision binary64 (if (<= k 1.95e-25) (* (sqrt n) (sqrt (* PI (/ 2.0 k)))) (sqrt (/ (pow (* 2.0 (* PI n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 1.95e-25) {
tmp = sqrt(n) * sqrt((((double) M_PI) * (2.0 / k)));
} 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 <= 1.95e-25) {
tmp = Math.sqrt(n) * Math.sqrt((Math.PI * (2.0 / k)));
} 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 <= 1.95e-25: tmp = math.sqrt(n) * math.sqrt((math.pi * (2.0 / k))) 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 <= 1.95e-25) tmp = Float64(sqrt(n) * sqrt(Float64(pi * Float64(2.0 / k)))); else tmp = sqrt(Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.95e-25) tmp = sqrt(n) * sqrt((pi * (2.0 / k))); else tmp = sqrt((((2.0 * (pi * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.95e-25], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.95 \cdot 10^{-25}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 1.95e-25Initial program 99.3%
Taylor expanded in k around 0 72.5%
associate-/l*72.5%
Simplified72.5%
sqrt-unprod72.6%
Applied egg-rr72.6%
pow1/272.6%
associate-*l*72.6%
unpow-prod-down99.5%
pow1/299.5%
Applied egg-rr99.5%
unpow1/299.5%
associate-*l/99.5%
associate-/l*99.5%
Simplified99.5%
if 1.95e-25 < k Initial program 99.6%
Applied egg-rr98.9%
*-commutative98.9%
distribute-lft-in98.9%
metadata-eval98.9%
*-commutative98.9%
associate-*r*98.9%
metadata-eval98.9%
neg-mul-198.9%
sub-neg98.9%
Simplified98.9%
Final simplification99.2%
(FPCore (k n) :precision binary64 (if (<= k 4.1e+132) (* (sqrt n) (sqrt (* PI (/ 2.0 k)))) (pow (pow (* PI (* n (/ 2.0 k))) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 4.1e+132) {
tmp = sqrt(n) * sqrt((((double) M_PI) * (2.0 / k)));
} else {
tmp = pow(pow((((double) M_PI) * (n * (2.0 / k))), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.1e+132) {
tmp = Math.sqrt(n) * Math.sqrt((Math.PI * (2.0 / k)));
} else {
tmp = Math.pow(Math.pow((Math.PI * (n * (2.0 / k))), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.1e+132: tmp = math.sqrt(n) * math.sqrt((math.pi * (2.0 / k))) else: tmp = math.pow(math.pow((math.pi * (n * (2.0 / k))), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.1e+132) tmp = Float64(sqrt(n) * sqrt(Float64(pi * Float64(2.0 / k)))); else tmp = (Float64(pi * Float64(n * Float64(2.0 / k))) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.1e+132) tmp = sqrt(n) * sqrt((pi * (2.0 / k))); else tmp = ((pi * (n * (2.0 / k))) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.1e+132], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(Pi * N[(n * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.1 \cdot 10^{+132}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{\pi \cdot \frac{2}{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\pi \cdot \left(n \cdot \frac{2}{k}\right)\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 4.09999999999999992e132Initial program 99.2%
Taylor expanded in k around 0 49.2%
associate-/l*49.2%
Simplified49.2%
sqrt-unprod49.3%
Applied egg-rr49.3%
pow1/249.3%
associate-*l*49.3%
unpow-prod-down66.3%
pow1/266.3%
Applied egg-rr66.3%
unpow1/266.3%
associate-*l/66.3%
associate-/l*66.3%
Simplified66.3%
if 4.09999999999999992e132 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
associate-/l*2.7%
Simplified2.7%
sqrt-unprod2.7%
Applied egg-rr2.7%
Taylor expanded in n around 0 2.7%
associate-*l/2.7%
associate-/r/2.7%
Simplified2.7%
pow1/22.7%
*-commutative2.7%
div-inv2.7%
clear-num2.7%
associate-*r*2.7%
metadata-eval2.7%
pow-pow4.0%
sqr-pow4.0%
pow-prod-down19.3%
pow-prod-up19.3%
metadata-eval19.3%
associate-*l/19.3%
metadata-eval19.3%
Applied egg-rr19.3%
*-commutative19.3%
associate-/l*19.3%
associate-*l*19.3%
Simplified19.3%
Final simplification53.6%
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (pow (* n (* 2.0 PI)) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return sqrt((1.0 / k)) * pow((n * (2.0 * ((double) M_PI))), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / k)) * Math.pow((n * (2.0 * Math.PI)), ((1.0 - k) / 2.0));
}
def code(k, n): return math.sqrt((1.0 / k)) * math.pow((n * (2.0 * math.pi)), ((1.0 - k) / 2.0))
function code(k, n) return Float64(sqrt(Float64(1.0 / k)) * (Float64(n * Float64(2.0 * pi)) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)) * ((n * (2.0 * pi)) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision] * N[Power[N[(n * N[(2.0 * Pi), $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(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 99.5%
Final simplification99.5%
(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.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
(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.4%
Taylor expanded in k around 0 36.7%
associate-/l*36.7%
Simplified36.7%
sqrt-unprod36.7%
Applied egg-rr36.7%
pow1/236.7%
associate-*l*36.7%
unpow-prod-down49.2%
pow1/249.2%
Applied egg-rr49.2%
unpow1/249.2%
associate-*l/49.2%
associate-/l*49.2%
Simplified49.2%
(FPCore (k n) :precision binary64 (pow (/ (/ k (* PI n)) 2.0) -0.5))
double code(double k, double n) {
return pow(((k / (((double) M_PI) * n)) / 2.0), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k / (Math.PI * n)) / 2.0), -0.5);
}
def code(k, n): return math.pow(((k / (math.pi * n)) / 2.0), -0.5)
function code(k, n) return Float64(Float64(k / Float64(pi * n)) / 2.0) ^ -0.5 end
function tmp = code(k, n) tmp = ((k / (pi * n)) / 2.0) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{\frac{k}{\pi \cdot n}}{2}\right)}^{-0.5}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0 36.7%
associate-/l*36.7%
Simplified36.7%
sqrt-unprod36.7%
Applied egg-rr36.7%
sqrt-prod36.7%
associate-*r/36.7%
*-commutative36.7%
sqrt-undiv49.0%
clear-num48.9%
sqrt-div36.8%
*-commutative36.8%
associate-/l/36.8%
associate-/r/36.8%
inv-pow36.8%
sqrt-undiv36.8%
sqrt-pow236.9%
associate-/l/36.9%
metadata-eval36.9%
Applied egg-rr36.9%
Final simplification36.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(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.4%
Taylor expanded in k around 0 36.7%
associate-/l*36.7%
Simplified36.7%
sqrt-unprod36.7%
Applied egg-rr36.7%
sqrt-prod36.7%
associate-*r/36.7%
*-commutative36.7%
sqrt-undiv49.0%
clear-num48.9%
sqrt-div36.8%
*-commutative36.8%
associate-/l/36.8%
associate-/r/36.8%
inv-pow36.8%
sqrt-undiv36.8%
sqrt-pow236.9%
associate-/l/36.9%
metadata-eval36.9%
Applied egg-rr36.9%
*-rgt-identity36.9%
associate-/l*36.9%
associate-/l/36.9%
metadata-eval36.9%
Simplified36.9%
Final simplification36.9%
(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 36.7%
associate-/l*36.7%
Simplified36.7%
sqrt-unprod36.7%
Applied egg-rr36.7%
Final simplification36.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.4%
Taylor expanded in k around 0 36.7%
associate-/l*36.7%
Simplified36.7%
sqrt-unprod36.7%
Applied egg-rr36.7%
Taylor expanded in n around 0 36.7%
associate-*l/36.7%
associate-/r/36.7%
Simplified36.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.4%
Taylor expanded in k around 0 36.7%
associate-/l*36.7%
Simplified36.7%
sqrt-unprod36.7%
Applied egg-rr36.7%
Taylor expanded in n around 0 36.7%
associate-*l/36.7%
associate-/r/36.7%
Simplified36.7%
associate-/r/36.7%
Applied egg-rr36.7%
Final simplification36.7%
herbie shell --seed 2024155
(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))))