
(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 0.5))))))
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 * 0.5)));
}
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 * 0.5)));
}
def code(k, n): t_0 = (2.0 * n) * math.pi return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(Float64(2.0 * n) * pi) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = (2.0 * n) * pi; tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(N[(2.0 * n), $MachinePrecision] * Pi), $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 := \left(2 \cdot n\right) \cdot \pi\\
\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.6%
*-un-lft-identity99.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
pow-div99.7%
pow1/299.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 (* n (* 2.0 PI))))
(if (<= k 2.4e-26)
(/ (sqrt t_0) (sqrt k))
(pow (* k (pow t_0 (+ k -1.0))) -0.5))))
double code(double k, double n) {
double t_0 = n * (2.0 * ((double) M_PI));
double tmp;
if (k <= 2.4e-26) {
tmp = sqrt(t_0) / sqrt(k);
} else {
tmp = pow((k * pow(t_0, (k + -1.0))), -0.5);
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = n * (2.0 * Math.PI);
double tmp;
if (k <= 2.4e-26) {
tmp = Math.sqrt(t_0) / Math.sqrt(k);
} else {
tmp = Math.pow((k * Math.pow(t_0, (k + -1.0))), -0.5);
}
return tmp;
}
def code(k, n): t_0 = n * (2.0 * math.pi) tmp = 0 if k <= 2.4e-26: tmp = math.sqrt(t_0) / math.sqrt(k) else: tmp = math.pow((k * math.pow(t_0, (k + -1.0))), -0.5) return tmp
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) tmp = 0.0 if (k <= 2.4e-26) tmp = Float64(sqrt(t_0) / sqrt(k)); else tmp = Float64(k * (t_0 ^ Float64(k + -1.0))) ^ -0.5; end return tmp end
function tmp_2 = code(k, n) t_0 = n * (2.0 * pi); tmp = 0.0; if (k <= 2.4e-26) tmp = sqrt(t_0) / sqrt(k); else tmp = (k * (t_0 ^ (k + -1.0))) ^ -0.5; end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2.4e-26], N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[(k * N[Power[t$95$0, N[(k + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\mathbf{if}\;k \leq 2.4 \cdot 10^{-26}:\\
\;\;\;\;\frac{\sqrt{t\_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(k \cdot {t\_0}^{\left(k + -1\right)}\right)}^{-0.5}\\
\end{array}
\end{array}
if k < 2.4000000000000001e-26Initial program 99.3%
add-sqr-sqrt99.0%
sqrt-unprod77.3%
*-commutative77.3%
associate-*r*77.3%
div-sub77.3%
metadata-eval77.3%
div-inv77.4%
*-commutative77.4%
Applied egg-rr77.5%
Simplified77.6%
pow-sub77.6%
pow177.6%
*-commutative77.6%
clear-num77.6%
*-commutative77.6%
associate-*r*77.6%
*-commutative77.6%
associate-*r*77.6%
associate-*r*77.6%
*-commutative77.6%
associate-*r*77.6%
Applied egg-rr77.6%
Taylor expanded in k around 0 77.6%
sqrt-div99.5%
associate-/r/99.5%
metadata-eval99.5%
*-commutative99.5%
Applied egg-rr99.5%
associate-*r*99.5%
*-commutative99.5%
Simplified99.5%
if 2.4000000000000001e-26 < k Initial program 99.6%
add-sqr-sqrt99.6%
sqrt-unprod99.6%
frac-times99.6%
metadata-eval99.6%
add-sqr-sqrt99.6%
Applied egg-rr99.6%
*-commutative99.6%
sqrt-pow199.0%
sqrt-prod99.0%
div-inv99.0%
clear-num99.0%
sqrt-div99.0%
metadata-eval99.0%
inv-pow99.0%
sqrt-pow299.0%
Applied egg-rr99.3%
*-commutative99.3%
*-commutative99.3%
associate-*r*99.3%
*-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Final simplification99.4%
(FPCore (k n) :precision binary64 (if (<= k 4.3e-44) (/ (sqrt (* n (* 2.0 PI))) (sqrt k)) (sqrt (/ (pow (* (* 2.0 n) PI) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 4.3e-44) {
tmp = sqrt((n * (2.0 * ((double) M_PI)))) / sqrt(k);
} else {
tmp = sqrt((pow(((2.0 * n) * ((double) M_PI)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.3e-44) {
tmp = Math.sqrt((n * (2.0 * Math.PI))) / Math.sqrt(k);
} else {
tmp = Math.sqrt((Math.pow(((2.0 * n) * Math.PI), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.3e-44: tmp = math.sqrt((n * (2.0 * math.pi))) / math.sqrt(k) else: tmp = math.sqrt((math.pow(((2.0 * n) * math.pi), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.3e-44) tmp = Float64(sqrt(Float64(n * Float64(2.0 * pi))) / sqrt(k)); else tmp = sqrt(Float64((Float64(Float64(2.0 * n) * pi) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.3e-44) tmp = sqrt((n * (2.0 * pi))) / sqrt(k); else tmp = sqrt(((((2.0 * n) * pi) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.3e-44], N[(N[Sqrt[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(N[(2.0 * n), $MachinePrecision] * Pi), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.3 \cdot 10^{-44}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\left(2 \cdot n\right) \cdot \pi\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 4.30000000000000013e-44Initial program 99.3%
add-sqr-sqrt99.0%
sqrt-unprod75.4%
*-commutative75.4%
associate-*r*75.4%
div-sub75.4%
metadata-eval75.4%
div-inv75.5%
*-commutative75.5%
Applied egg-rr75.6%
Simplified75.7%
pow-sub75.7%
pow175.7%
*-commutative75.7%
clear-num75.6%
*-commutative75.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
associate-*r*75.6%
*-commutative75.6%
associate-*r*75.6%
Applied egg-rr75.6%
Taylor expanded in k around 0 75.6%
sqrt-div99.5%
associate-/r/99.5%
metadata-eval99.5%
*-commutative99.5%
Applied egg-rr99.5%
associate-*r*99.5%
*-commutative99.5%
Simplified99.5%
if 4.30000000000000013e-44 < k Initial program 99.6%
add-sqr-sqrt99.6%
sqrt-unprod99.0%
*-commutative99.0%
associate-*r*99.0%
div-sub99.0%
metadata-eval99.0%
div-inv99.0%
*-commutative99.0%
Applied egg-rr99.0%
Simplified99.0%
Final simplification99.2%
(FPCore (k n) :precision binary64 (if (<= k 2.5e+204) (/ (sqrt (* n (* 2.0 PI))) (sqrt k)) (pow (pow (* n (* PI (/ 2.0 k))) 2.0) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 2.5e+204) {
tmp = sqrt((n * (2.0 * ((double) M_PI)))) / sqrt(k);
} else {
tmp = pow(pow((n * (((double) M_PI) * (2.0 / k))), 2.0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.5e+204) {
tmp = Math.sqrt((n * (2.0 * Math.PI))) / Math.sqrt(k);
} else {
tmp = Math.pow(Math.pow((n * (Math.PI * (2.0 / k))), 2.0), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2.5e+204: tmp = math.sqrt((n * (2.0 * math.pi))) / math.sqrt(k) else: tmp = math.pow(math.pow((n * (math.pi * (2.0 / k))), 2.0), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 2.5e+204) tmp = Float64(sqrt(Float64(n * Float64(2.0 * pi))) / sqrt(k)); else tmp = (Float64(n * Float64(pi * Float64(2.0 / k))) ^ 2.0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.5e+204) tmp = sqrt((n * (2.0 * pi))) / sqrt(k); else tmp = ((n * (pi * (2.0 / k))) ^ 2.0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.5e+204], N[(N[Sqrt[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(n * N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.5 \cdot 10^{+204}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(n \cdot \left(\pi \cdot \frac{2}{k}\right)\right)}^{2}\right)}^{0.25}\\
\end{array}
\end{array}
if k < 2.50000000000000004e204Initial program 99.4%
add-sqr-sqrt99.2%
sqrt-unprod87.2%
*-commutative87.2%
associate-*r*87.2%
div-sub87.2%
metadata-eval87.2%
div-inv87.2%
*-commutative87.2%
Applied egg-rr87.3%
Simplified87.3%
pow-sub87.5%
pow187.5%
*-commutative87.5%
clear-num87.5%
*-commutative87.5%
associate-*r*87.5%
*-commutative87.5%
associate-*r*87.5%
associate-*r*87.5%
*-commutative87.5%
associate-*r*87.5%
Applied egg-rr87.5%
Taylor expanded in k around 0 45.6%
sqrt-div57.3%
associate-/r/57.3%
metadata-eval57.3%
*-commutative57.3%
Applied egg-rr57.3%
associate-*r*57.3%
*-commutative57.3%
Simplified57.3%
if 2.50000000000000004e204 < k Initial program 100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
*-commutative100.0%
associate-*r*100.0%
div-sub100.0%
metadata-eval100.0%
div-inv100.0%
*-commutative100.0%
Applied egg-rr100.0%
Simplified100.0%
pow-sub100.0%
pow1100.0%
*-commutative100.0%
clear-num100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Applied egg-rr100.0%
Taylor expanded in k around 0 2.5%
pow1/22.5%
associate-/r/2.5%
metadata-eval2.5%
*-commutative2.5%
associate-*r*2.5%
*-commutative2.5%
metadata-eval2.5%
pow-prod-up2.5%
pow-prod-down14.4%
pow214.4%
*-commutative14.4%
associate-*r*14.4%
*-commutative14.4%
*-un-lft-identity14.4%
times-frac14.4%
metadata-eval14.4%
*-commutative14.4%
Applied egg-rr14.4%
*-commutative14.4%
*-commutative14.4%
associate-/l*14.4%
associate-*l*14.4%
associate-*l/14.4%
associate-/l*14.4%
Simplified14.4%
Final simplification49.2%
(FPCore (k n) :precision binary64 (/ (pow (* 2.0 (* n PI)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((2.0 * (n * ((double) M_PI))), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((2.0 * (n * Math.PI)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((2.0 * (n * math.pi)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(2.0 * Float64(n * pi)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((2.0 * (n * pi)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(n * Pi), $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(n \cdot \pi\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* 2.0 (/ PI k)))))
double code(double k, double n) {
return sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
}
public static double code(double k, double n) {
return Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
}
def code(k, n): return math.sqrt(n) * math.sqrt((2.0 * (math.pi / k)))
function code(k, n) return Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); end
code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod89.6%
*-commutative89.6%
associate-*r*89.6%
div-sub89.6%
metadata-eval89.6%
div-inv89.6%
*-commutative89.6%
Applied egg-rr89.7%
Simplified89.7%
pow-sub89.9%
pow189.9%
*-commutative89.9%
clear-num89.9%
*-commutative89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
Applied egg-rr89.9%
Taylor expanded in k around 0 37.5%
pow1/237.5%
associate-/r/37.5%
metadata-eval37.5%
*-commutative37.5%
associate-*r*37.5%
*-commutative37.5%
associate-/l*37.5%
unpow-prod-down47.0%
pow1/247.0%
*-un-lft-identity47.0%
times-frac47.0%
metadata-eval47.0%
Applied egg-rr47.0%
unpow1/247.0%
Simplified47.0%
Final simplification47.0%
(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.5%
add-sqr-sqrt99.4%
sqrt-unprod89.6%
*-commutative89.6%
associate-*r*89.6%
div-sub89.6%
metadata-eval89.6%
div-inv89.6%
*-commutative89.6%
Applied egg-rr89.7%
Simplified89.7%
pow-sub89.9%
pow189.9%
*-commutative89.9%
clear-num89.9%
*-commutative89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
Applied egg-rr89.9%
Taylor expanded in k around 0 37.5%
pow1/237.5%
associate-/r/37.5%
metadata-eval37.5%
*-commutative37.5%
associate-*r*37.5%
*-commutative37.5%
associate-/l*37.5%
unpow-prod-down47.0%
pow1/247.0%
*-un-lft-identity47.0%
times-frac47.0%
metadata-eval47.0%
Applied egg-rr47.0%
unpow1/247.0%
associate-*r/47.0%
*-commutative47.0%
associate-/l*47.0%
Simplified47.0%
Final simplification47.0%
(FPCore (k n) :precision binary64 (/ (sqrt (* n (* 2.0 PI))) (sqrt k)))
double code(double k, double n) {
return sqrt((n * (2.0 * ((double) M_PI)))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((n * (2.0 * Math.PI))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((n * (2.0 * math.pi))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(n * Float64(2.0 * pi))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((n * (2.0 * pi))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod89.6%
*-commutative89.6%
associate-*r*89.6%
div-sub89.6%
metadata-eval89.6%
div-inv89.6%
*-commutative89.6%
Applied egg-rr89.7%
Simplified89.7%
pow-sub89.9%
pow189.9%
*-commutative89.9%
clear-num89.9%
*-commutative89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
Applied egg-rr89.9%
Taylor expanded in k around 0 37.5%
sqrt-div47.0%
associate-/r/47.0%
metadata-eval47.0%
*-commutative47.0%
Applied egg-rr47.0%
associate-*r*47.0%
*-commutative47.0%
Simplified47.0%
Final simplification47.0%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (* k (/ 0.5 (* n PI))))))
double code(double k, double n) {
return 1.0 / sqrt((k * (0.5 / (n * ((double) M_PI)))));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt((k * (0.5 / (n * Math.PI))));
}
def code(k, n): return 1.0 / math.sqrt((k * (0.5 / (n * math.pi))))
function code(k, n) return Float64(1.0 / sqrt(Float64(k * Float64(0.5 / Float64(n * pi))))) end
function tmp = code(k, n) tmp = 1.0 / sqrt((k * (0.5 / (n * pi)))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(k * N[(0.5 / N[(n * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{k \cdot \frac{0.5}{n \cdot \pi}}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod89.6%
*-commutative89.6%
associate-*r*89.6%
div-sub89.6%
metadata-eval89.6%
div-inv89.6%
*-commutative89.6%
Applied egg-rr89.7%
Simplified89.7%
pow-sub89.9%
pow189.9%
*-commutative89.9%
clear-num89.9%
*-commutative89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
Applied egg-rr89.9%
Taylor expanded in k around 0 37.5%
associate-/l/37.5%
sqrt-div38.1%
metadata-eval38.1%
*-commutative38.1%
Applied egg-rr38.1%
Final simplification38.1%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (* k (/ (/ 0.5 n) PI)))))
double code(double k, double n) {
return 1.0 / sqrt((k * ((0.5 / n) / ((double) M_PI))));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt((k * ((0.5 / n) / Math.PI)));
}
def code(k, n): return 1.0 / math.sqrt((k * ((0.5 / n) / math.pi)))
function code(k, n) return Float64(1.0 / sqrt(Float64(k * Float64(Float64(0.5 / n) / pi)))) end
function tmp = code(k, n) tmp = 1.0 / sqrt((k * ((0.5 / n) / pi))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(k * N[(N[(0.5 / n), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{k \cdot \frac{\frac{0.5}{n}}{\pi}}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod89.6%
*-commutative89.6%
associate-*r*89.6%
div-sub89.6%
metadata-eval89.6%
div-inv89.6%
*-commutative89.6%
Applied egg-rr89.7%
Simplified89.7%
pow-sub89.9%
pow189.9%
*-commutative89.9%
clear-num89.9%
*-commutative89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
Applied egg-rr89.9%
Taylor expanded in k around 0 37.5%
clear-num37.5%
sqrt-div38.1%
metadata-eval38.1%
*-un-lft-identity38.1%
associate-/r/38.1%
metadata-eval38.1%
times-frac38.1%
metadata-eval38.1%
*-commutative38.1%
Applied egg-rr38.1%
associate-*r/38.1%
*-commutative38.1%
*-commutative38.1%
associate-*r/38.1%
associate-/r*38.1%
Simplified38.1%
Final simplification38.1%
(FPCore (k n) :precision binary64 (sqrt (* n (* 2.0 (/ PI k)))))
double code(double k, double n) {
return sqrt((n * (2.0 * (((double) M_PI) / k))));
}
public static double code(double k, double n) {
return Math.sqrt((n * (2.0 * (Math.PI / k))));
}
def code(k, n): return math.sqrt((n * (2.0 * (math.pi / k))))
function code(k, n) return sqrt(Float64(n * Float64(2.0 * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt((n * (2.0 * (pi / k)))); end
code[k_, n_] := N[Sqrt[N[(n * N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \left(2 \cdot \frac{\pi}{k}\right)}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod89.6%
*-commutative89.6%
associate-*r*89.6%
div-sub89.6%
metadata-eval89.6%
div-inv89.6%
*-commutative89.6%
Applied egg-rr89.7%
Simplified89.7%
*-commutative89.7%
sub-neg89.7%
unpow-prod-up89.9%
pow189.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
Applied egg-rr89.9%
Taylor expanded in k around 0 37.5%
*-commutative37.5%
associate-/l*37.5%
associate-*l*37.5%
*-commutative37.5%
Simplified37.5%
Final simplification37.5%
herbie shell --seed 2024044
(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))))