
(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 n) PI))) (/ (sqrt t_0) (sqrt (* k (pow t_0 k))))))
double code(double k, double n) {
double t_0 = (2.0 * n) * ((double) M_PI);
return sqrt(t_0) / sqrt((k * pow(t_0, k)));
}
public static double code(double k, double n) {
double t_0 = (2.0 * n) * Math.PI;
return Math.sqrt(t_0) / Math.sqrt((k * Math.pow(t_0, k)));
}
def code(k, n): t_0 = (2.0 * n) * math.pi return math.sqrt(t_0) / math.sqrt((k * math.pow(t_0, k)))
function code(k, n) t_0 = Float64(Float64(2.0 * n) * pi) return Float64(sqrt(t_0) / sqrt(Float64(k * (t_0 ^ k)))) end
function tmp = code(k, n) t_0 = (2.0 * n) * pi; tmp = sqrt(t_0) / sqrt((k * (t_0 ^ k))); end
code[k_, n_] := Block[{t$95$0 = N[(N[(2.0 * n), $MachinePrecision] * Pi), $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 := \left(2 \cdot n\right) \cdot \pi\\
\frac{\sqrt{t_0}}{\sqrt{k \cdot {t_0}^{k}}}
\end{array}
\end{array}
Initial program 99.5%
div-sub99.5%
metadata-eval99.5%
pow-sub99.6%
pow1/299.6%
associate-*l*99.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%
expm1-log1p-u96.7%
expm1-udef84.1%
frac-times84.1%
*-un-lft-identity84.1%
associate-*r*84.1%
associate-*r*84.1%
Applied egg-rr84.1%
expm1-def96.7%
expm1-log1p99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
expm1-log1p-u96.7%
expm1-udef84.1%
pow1/284.1%
pow-unpow84.1%
pow-prod-down84.1%
Applied egg-rr84.1%
expm1-def96.8%
expm1-log1p99.7%
associate-*r*99.7%
*-commutative99.7%
unpow1/299.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(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.5%
add-sqr-sqrt99.4%
sqrt-unprod99.5%
frac-times99.5%
metadata-eval99.5%
add-sqr-sqrt99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (* (pow (* n (* 2.0 PI)) (/ (- 1.0 k) 2.0)) (pow k -0.5)))
double code(double k, double n) {
return pow((n * (2.0 * ((double) M_PI))), ((1.0 - k) / 2.0)) * pow(k, -0.5);
}
public static double code(double k, double n) {
return Math.pow((n * (2.0 * Math.PI)), ((1.0 - k) / 2.0)) * Math.pow(k, -0.5);
}
def code(k, n): return math.pow((n * (2.0 * math.pi)), ((1.0 - k) / 2.0)) * math.pow(k, -0.5)
function code(k, n) return Float64((Float64(n * Float64(2.0 * pi)) ^ Float64(Float64(1.0 - k) / 2.0)) * (k ^ -0.5)) end
function tmp = code(k, n) tmp = ((n * (2.0 * pi)) ^ ((1.0 - k) / 2.0)) * (k ^ -0.5); end
code[k_, n_] := N[(N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {k}^{-0.5}
\end{array}
Initial program 99.5%
expm1-log1p-u95.7%
expm1-udef70.7%
inv-pow70.7%
sqrt-pow270.7%
metadata-eval70.7%
Applied egg-rr70.7%
expm1-def95.7%
expm1-log1p99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* (* 2.0 n) PI) (/ (- 1.0 k) 2.0)) (sqrt k)))
double code(double k, double n) {
return pow(((2.0 * n) * ((double) M_PI)), ((1.0 - k) / 2.0)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow(((2.0 * n) * Math.PI), ((1.0 - k) / 2.0)) / Math.sqrt(k);
}
def code(k, n): return math.pow(((2.0 * n) * math.pi), ((1.0 - k) / 2.0)) / math.sqrt(k)
function code(k, n) return Float64((Float64(Float64(2.0 * n) * pi) ^ Float64(Float64(1.0 - k) / 2.0)) / sqrt(k)) end
function tmp = code(k, n) tmp = (((2.0 * n) * pi) ^ ((1.0 - k) / 2.0)) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(N[(2.0 * n), $MachinePrecision] * Pi), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\left(2 \cdot n\right) \cdot \pi\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 6.2e+226) (* (/ 1.0 (sqrt (/ k (* n PI)))) (sqrt 2.0)) (cbrt (pow (* 2.0 (* PI (/ n k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 6.2e+226) {
tmp = (1.0 / sqrt((k / (n * ((double) M_PI))))) * sqrt(2.0);
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) * (n / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 6.2e+226) {
tmp = (1.0 / Math.sqrt((k / (n * Math.PI)))) * Math.sqrt(2.0);
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI * (n / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 6.2e+226) tmp = Float64(Float64(1.0 / sqrt(Float64(k / Float64(n * pi)))) * sqrt(2.0)); else tmp = cbrt((Float64(2.0 * Float64(pi * Float64(n / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 6.2e+226], N[(N[(1.0 / N[Sqrt[N[(k / N[(n * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.2 \cdot 10^{+226}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{n \cdot \pi}}} \cdot \sqrt{2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 6.19999999999999952e226Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.5%
expm1-log1p-u96.2%
expm1-udef81.7%
Applied egg-rr67.6%
expm1-def82.0%
expm1-log1p84.0%
associate-*r*84.0%
Simplified84.0%
Taylor expanded in k around 0 47.2%
associate-/l*47.2%
associate-/r/47.2%
Simplified47.2%
pow1/247.2%
*-commutative47.2%
unpow-prod-down47.1%
pow1/247.1%
*-commutative47.1%
pow1/247.1%
Applied egg-rr47.1%
clear-num47.1%
div-inv47.1%
clear-num47.1%
sqrt-div47.8%
metadata-eval47.8%
Applied egg-rr47.8%
associate-/r*47.8%
Simplified47.8%
if 6.19999999999999952e226 < k Initial program 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
div-inv100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in k around 0 2.8%
associate-/l*2.8%
associate-/r/2.8%
Simplified2.8%
add-cbrt-cube17.2%
pow1/317.2%
add-sqr-sqrt17.2%
pow117.2%
pow1/217.2%
pow-prod-up17.2%
*-commutative17.2%
metadata-eval17.2%
Applied egg-rr17.2%
unpow1/317.2%
Simplified17.2%
Final simplification43.9%
(FPCore (k n) :precision binary64 (pow (/ k (pow (* (* 2.0 n) PI) (- 1.0 k))) -0.5))
double code(double k, double n) {
return pow((k / pow(((2.0 * n) * ((double) M_PI)), (1.0 - k))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / Math.pow(((2.0 * n) * Math.PI), (1.0 - k))), -0.5);
}
def code(k, n): return math.pow((k / math.pow(((2.0 * n) * math.pi), (1.0 - k))), -0.5)
function code(k, n) return Float64(k / (Float64(Float64(2.0 * n) * pi) ^ Float64(1.0 - k))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (((2.0 * n) * pi) ^ (1.0 - k))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[Power[N[(N[(2.0 * n), $MachinePrecision] * Pi), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{{\left(\left(2 \cdot n\right) \cdot \pi\right)}^{\left(1 - k\right)}}\right)}^{-0.5}
\end{array}
Initial program 99.5%
*-commutative99.5%
associate-*r*99.5%
associate-/r/99.5%
add-sqr-sqrt99.3%
sqrt-unprod99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r*99.5%
*-commutative99.5%
pow-prod-up99.5%
Applied egg-rr99.5%
Taylor expanded in n around 0 83.7%
+-commutative83.7%
exp-prod83.4%
log-prod83.8%
associate-*r*83.8%
*-commutative83.8%
exp-prod83.9%
*-commutative83.9%
exp-to-pow86.7%
*-commutative86.7%
associate-*l*86.7%
*-commutative86.7%
Simplified86.7%
expm1-log1p-u85.0%
expm1-udef72.4%
pow1/272.4%
pow-flip72.4%
metadata-eval72.4%
Applied egg-rr72.4%
expm1-def85.0%
expm1-log1p86.7%
Simplified86.7%
Final simplification86.7%
(FPCore (k n) :precision binary64 (if (<= k 1e+234) (/ (sqrt (* 2.0 PI)) (sqrt (/ k n))) (cbrt (pow (* 2.0 (* PI (/ n k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 1e+234) {
tmp = sqrt((2.0 * ((double) M_PI))) / sqrt((k / n));
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) * (n / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1e+234) {
tmp = Math.sqrt((2.0 * Math.PI)) / Math.sqrt((k / n));
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI * (n / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1e+234) tmp = Float64(sqrt(Float64(2.0 * pi)) / sqrt(Float64(k / n))); else tmp = cbrt((Float64(2.0 * Float64(pi * Float64(n / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 1e+234], N[(N[Sqrt[N[(2.0 * Pi), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 10^{+234}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \pi}}{\sqrt{\frac{k}{n}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 1.00000000000000002e234Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.5%
expm1-log1p-u96.2%
expm1-udef81.9%
Applied egg-rr67.8%
expm1-def82.2%
expm1-log1p84.2%
associate-*r*84.2%
Simplified84.2%
Taylor expanded in k around 0 46.8%
associate-/l*46.8%
associate-/r/46.8%
Simplified46.8%
Taylor expanded in n around 0 46.8%
*-commutative46.8%
associate-/l*46.8%
Simplified46.8%
associate-*r/46.8%
sqrt-div47.2%
Applied egg-rr47.2%
if 1.00000000000000002e234 < k Initial program 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
div-inv100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in k around 0 2.9%
associate-/l*2.9%
associate-/r/2.9%
Simplified2.9%
add-cbrt-cube18.2%
pow1/318.2%
add-sqr-sqrt18.2%
pow118.2%
pow1/218.2%
pow-prod-up18.2%
*-commutative18.2%
metadata-eval18.2%
Applied egg-rr18.2%
unpow1/318.2%
Simplified18.2%
Final simplification43.7%
(FPCore (k n) :precision binary64 (sqrt (/ (pow (* n (* 2.0 PI)) (- 1.0 k)) k)))
double code(double k, double n) {
return sqrt((pow((n * (2.0 * ((double) M_PI))), (1.0 - k)) / k));
}
public static double code(double k, double n) {
return Math.sqrt((Math.pow((n * (2.0 * Math.PI)), (1.0 - k)) / k));
}
def code(k, n): return math.sqrt((math.pow((n * (2.0 * math.pi)), (1.0 - k)) / k))
function code(k, n) return sqrt(Float64((Float64(n * Float64(2.0 * pi)) ^ Float64(1.0 - k)) / k)) end
function tmp = code(k, n) tmp = sqrt((((n * (2.0 * pi)) ^ (1.0 - k)) / k)); end
code[k_, n_] := N[Sqrt[N[(N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(1 - k\right)}}{k}}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u96.7%
expm1-udef84.1%
Applied egg-rr71.7%
expm1-def84.4%
expm1-log1p86.1%
associate-*r*86.1%
Simplified86.1%
Final simplification86.1%
(FPCore (k n) :precision binary64 (/ (sqrt (* 2.0 PI)) (sqrt (/ k n))))
double code(double k, double n) {
return sqrt((2.0 * ((double) M_PI))) / sqrt((k / n));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * Math.PI)) / Math.sqrt((k / n));
}
def code(k, n): return math.sqrt((2.0 * math.pi)) / math.sqrt((k / n))
function code(k, n) return Float64(sqrt(Float64(2.0 * pi)) / sqrt(Float64(k / n))) end
function tmp = code(k, n) tmp = sqrt((2.0 * pi)) / sqrt((k / n)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * Pi), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2 \cdot \pi}}{\sqrt{\frac{k}{n}}}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u96.7%
expm1-udef84.1%
Applied egg-rr71.7%
expm1-def84.4%
expm1-log1p86.1%
associate-*r*86.1%
Simplified86.1%
Taylor expanded in k around 0 41.5%
associate-/l*41.5%
associate-/r/41.5%
Simplified41.5%
Taylor expanded in n around 0 41.5%
*-commutative41.5%
associate-/l*41.5%
Simplified41.5%
associate-*r/41.5%
sqrt-div41.8%
Applied egg-rr41.8%
Final simplification41.8%
(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%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u96.7%
expm1-udef84.1%
Applied egg-rr71.7%
expm1-def84.4%
expm1-log1p86.1%
associate-*r*86.1%
Simplified86.1%
Taylor expanded in k around 0 41.5%
associate-/l*41.5%
associate-/r/41.5%
Simplified41.5%
Final simplification41.5%
(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(Float64(2.0 * pi) * Float64(n / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * pi) * (n / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * Pi), $MachinePrecision] * N[(n / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot \pi\right) \cdot \frac{n}{k}}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u96.7%
expm1-udef84.1%
Applied egg-rr71.7%
expm1-def84.4%
expm1-log1p86.1%
associate-*r*86.1%
Simplified86.1%
Taylor expanded in k around 0 41.5%
associate-/l*41.5%
associate-/r/41.5%
Simplified41.5%
Taylor expanded in n around 0 41.5%
*-commutative41.5%
associate-/l*41.5%
Simplified41.5%
expm1-log1p-u39.8%
expm1-udef37.4%
div-inv37.4%
clear-num37.4%
Applied egg-rr37.4%
expm1-def39.8%
expm1-log1p41.5%
associate-*r*41.5%
Simplified41.5%
Final simplification41.5%
herbie shell --seed 2023214
(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))))