
(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 (* n PI)))) (* (/ (sqrt t_0) (pow t_0 (* 0.5 k))) (pow k -0.5))))
double code(double k, double n) {
double t_0 = 2.0 * (n * ((double) M_PI));
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 = 2.0 * (n * Math.PI);
return (Math.sqrt(t_0) / Math.pow(t_0, (0.5 * k))) * Math.pow(k, -0.5);
}
def code(k, n): t_0 = 2.0 * (n * math.pi) return (math.sqrt(t_0) / math.pow(t_0, (0.5 * k))) * math.pow(k, -0.5)
function code(k, n) t_0 = Float64(2.0 * Float64(n * pi)) return Float64(Float64(sqrt(t_0) / (t_0 ^ Float64(0.5 * k))) * (k ^ -0.5)) end
function tmp = code(k, n) t_0 = 2.0 * (n * pi); tmp = (sqrt(t_0) / (t_0 ^ (0.5 * k))) * (k ^ -0.5); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(n * Pi), $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 := 2 \cdot \left(n \cdot \pi\right)\\
\frac{\sqrt{t_0}}{{t_0}^{\left(0.5 \cdot k\right)}} \cdot {k}^{-0.5}
\end{array}
\end{array}
Initial program 99.5%
unpow-prod-down75.9%
unpow-prod-down99.5%
div-sub99.5%
metadata-eval99.5%
pow-sub99.7%
pow1/299.7%
associate-*r/99.7%
inv-pow99.7%
sqrt-pow299.7%
metadata-eval99.7%
associate-*l*99.7%
associate-*l*99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
*-commutative99.7%
associate-/l*99.6%
associate-/r/99.7%
*-commutative99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(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(2.0 * Float64(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[(2.0 * N[(n * Pi), $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 := 2 \cdot \left(n \cdot \pi\right)\\
\frac{\sqrt{t_0}}{\sqrt{k \cdot {t_0}^{k}}}
\end{array}
\end{array}
Initial program 99.5%
unpow-prod-down75.9%
unpow-prod-down99.5%
div-sub99.5%
metadata-eval99.5%
pow-sub99.7%
pow1/299.7%
frac-times99.7%
*-un-lft-identity99.7%
associate-*l*99.7%
associate-*l*99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
div-inv99.7%
*-commutative99.7%
pow-unpow99.7%
pow1/299.7%
pow-prod-down99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-commutative99.7%
*-lft-identity99.7%
*-commutative99.7%
unpow1/299.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 3e-17) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (/ 1.0 (sqrt (/ k (pow (* n (* 2.0 PI)) (- 1.0 k)))))))
double code(double k, double n) {
double tmp;
if (k <= 3e-17) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
} else {
tmp = 1.0 / sqrt((k / pow((n * (2.0 * ((double) M_PI))), (1.0 - k))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3e-17) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
} else {
tmp = 1.0 / Math.sqrt((k / Math.pow((n * (2.0 * Math.PI)), (1.0 - k))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 3e-17: tmp = math.sqrt(n) * math.sqrt((2.0 * (math.pi / k))) else: tmp = 1.0 / math.sqrt((k / math.pow((n * (2.0 * math.pi)), (1.0 - k)))) return tmp
function code(k, n) tmp = 0.0 if (k <= 3e-17) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = Float64(1.0 / sqrt(Float64(k / (Float64(n * Float64(2.0 * pi)) ^ Float64(1.0 - k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 3e-17) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); else tmp = 1.0 / sqrt((k / ((n * (2.0 * pi)) ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 3e-17], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k / N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 3.00000000000000006e-17Initial program 99.2%
*-commutative99.2%
div-sub99.2%
metadata-eval99.2%
div-inv99.3%
add-sqr-sqrt98.9%
sqrt-unprod71.4%
frac-times71.4%
Applied egg-rr71.6%
Taylor expanded in k around 0 71.6%
*-commutative71.6%
associate-*r*71.6%
*-commutative71.6%
Simplified71.6%
pow1/271.6%
pow-to-exp66.8%
associate-/l*66.8%
Applied egg-rr66.8%
exp-to-pow71.6%
pow1/271.7%
div-inv71.6%
sqrt-prod99.3%
clear-num99.3%
*-un-lft-identity99.3%
times-frac99.3%
metadata-eval99.3%
Applied egg-rr99.3%
if 3.00000000000000006e-17 < k Initial program 99.7%
unpow-prod-down55.3%
unpow-prod-down99.7%
div-sub99.7%
metadata-eval99.7%
pow-sub100.0%
pow1/2100.0%
associate-*r/100.0%
inv-pow100.0%
sqrt-pow2100.0%
metadata-eval100.0%
associate-*l*100.0%
associate-*l*100.0%
div-inv100.0%
metadata-eval100.0%
Applied egg-rr100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/r/100.0%
*-commutative100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 1.32e-17) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (sqrt (/ (pow (* 2.0 (* n PI)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 1.32e-17) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / 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 <= 1.32e-17) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / 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 <= 1.32e-17: tmp = math.sqrt(n) * math.sqrt((2.0 * (math.pi / 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 <= 1.32e-17) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = sqrt(Float64((Float64(2.0 * Float64(n * pi)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.32e-17) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); else tmp = sqrt((((2.0 * (n * pi)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.32e-17], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(2.0 * N[(n * Pi), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(2 \cdot \left(n \cdot \pi\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 1.3200000000000001e-17Initial program 99.3%
*-commutative99.3%
div-sub99.3%
metadata-eval99.3%
div-inv99.3%
add-sqr-sqrt98.9%
sqrt-unprod71.3%
frac-times71.2%
Applied egg-rr71.5%
Taylor expanded in k around 0 71.5%
*-commutative71.5%
associate-*r*71.5%
*-commutative71.5%
Simplified71.5%
pow1/271.4%
pow-to-exp66.6%
associate-/l*66.6%
Applied egg-rr66.6%
exp-to-pow71.5%
pow1/271.5%
div-inv71.4%
sqrt-prod99.3%
clear-num99.4%
*-un-lft-identity99.4%
times-frac99.4%
metadata-eval99.4%
Applied egg-rr99.4%
if 1.3200000000000001e-17 < k Initial program 99.7%
*-commutative99.7%
div-sub99.7%
metadata-eval99.7%
div-inv99.7%
add-sqr-sqrt99.7%
sqrt-unprod99.7%
frac-times99.7%
Applied egg-rr99.7%
Final simplification99.5%
(FPCore (k n) :precision binary64 (/ (pow (* n (* 2.0 PI)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((n * (2.0 * ((double) M_PI))), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((n * (2.0 * Math.PI)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((n * (2.0 * math.pi)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(n * Float64(2.0 * pi)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((n * (2.0 * pi)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(n * N[(2.0 * Pi), $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(2 \cdot \pi\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-lft-identity99.5%
sqr-pow99.4%
pow-sqr99.5%
*-commutative99.5%
associate-*l/99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 2.5e+254) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (cbrt (pow (* 2.0 (* PI (/ n k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 2.5e+254) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
} 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 <= 2.5e+254) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
} 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 <= 2.5e+254) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = cbrt((Float64(2.0 * Float64(pi * Float64(n / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 2.5e+254], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $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 2.5 \cdot 10^{+254}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 2.49999999999999997e254Initial program 99.4%
*-commutative99.4%
div-sub99.4%
metadata-eval99.4%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod85.0%
frac-times84.9%
Applied egg-rr85.1%
Taylor expanded in k around 0 39.4%
*-commutative39.4%
associate-*r*39.4%
*-commutative39.4%
Simplified39.4%
pow1/239.4%
pow-to-exp36.9%
associate-/l*36.9%
Applied egg-rr36.9%
exp-to-pow39.4%
pow1/239.4%
div-inv39.4%
sqrt-prod53.8%
clear-num53.9%
*-un-lft-identity53.9%
times-frac53.9%
metadata-eval53.9%
Applied egg-rr53.9%
if 2.49999999999999997e254 < k Initial program 100.0%
*-commutative100.0%
div-sub100.0%
metadata-eval100.0%
div-inv100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
frac-times100.0%
Applied egg-rr100.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
associate-*r*2.9%
*-commutative2.9%
Simplified2.9%
add-cbrt-cube26.8%
pow1/326.8%
add-sqr-sqrt26.8%
pow126.8%
pow1/226.8%
pow-prod-up26.8%
associate-/l*26.8%
metadata-eval26.8%
Applied egg-rr26.8%
unpow1/326.8%
associate-/r/26.8%
associate-*l/26.8%
*-commutative26.8%
associate-*l*26.8%
*-commutative26.8%
associate-*r/26.8%
associate-/l*26.8%
associate-/r/26.8%
Simplified26.8%
Final simplification51.3%
(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%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod86.4%
frac-times86.3%
Applied egg-rr86.5%
Taylor expanded in k around 0 36.0%
*-commutative36.0%
associate-*r*36.0%
*-commutative36.0%
Simplified36.0%
pow1/236.0%
pow-to-exp33.7%
associate-/l*33.7%
Applied egg-rr33.7%
exp-to-pow36.0%
pow1/236.0%
div-inv36.0%
sqrt-prod49.1%
clear-num49.1%
*-un-lft-identity49.1%
times-frac49.1%
metadata-eval49.1%
Applied egg-rr49.1%
Final simplification49.1%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (* 0.5 (/ k n)) PI))))
double code(double k, double n) {
return 1.0 / sqrt(((0.5 * (k / n)) / ((double) M_PI)));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt(((0.5 * (k / n)) / Math.PI));
}
def code(k, n): return 1.0 / math.sqrt(((0.5 * (k / n)) / math.pi))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(0.5 * Float64(k / n)) / pi))) end
function tmp = code(k, n) tmp = 1.0 / sqrt(((0.5 * (k / n)) / pi)); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(0.5 * N[(k / n), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}
\end{array}
Initial program 99.5%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod86.4%
frac-times86.3%
Applied egg-rr86.5%
Taylor expanded in k around 0 36.0%
*-commutative36.0%
associate-*r*36.0%
*-commutative36.0%
Simplified36.0%
Taylor expanded in n around 0 36.0%
associate-/l*36.0%
associate-/r/36.0%
Simplified36.0%
metadata-eval36.0%
associate-*l/36.0%
times-frac36.0%
*-commutative36.0%
add-cube-cbrt35.6%
unpow335.6%
*-un-lft-identity35.6%
clear-num35.6%
sqrt-div37.0%
metadata-eval37.0%
*-un-lft-identity37.0%
unpow337.0%
add-cube-cbrt37.3%
*-commutative37.3%
times-frac37.3%
metadata-eval37.3%
Applied egg-rr37.3%
associate-*r/37.3%
*-commutative37.3%
associate-/l/37.3%
associate-/l/37.3%
*-commutative37.3%
associate-*r/37.3%
associate-/r*37.3%
associate-*r/37.3%
Simplified37.3%
Final simplification37.3%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (/ (* 0.5 k) PI) n))))
double code(double k, double n) {
return 1.0 / sqrt((((0.5 * k) / ((double) M_PI)) / n));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt((((0.5 * k) / Math.PI) / n));
}
def code(k, n): return 1.0 / math.sqrt((((0.5 * k) / math.pi) / n))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(Float64(0.5 * k) / pi) / n))) end
function tmp = code(k, n) tmp = 1.0 / sqrt((((0.5 * k) / pi) / n)); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(N[(0.5 * k), $MachinePrecision] / Pi), $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{\frac{0.5 \cdot k}{\pi}}{n}}}
\end{array}
Initial program 99.5%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod86.4%
frac-times86.3%
Applied egg-rr86.5%
Taylor expanded in k around 0 36.0%
*-commutative36.0%
associate-*r*36.0%
*-commutative36.0%
Simplified36.0%
pow1/236.0%
pow-to-exp33.7%
associate-/l*33.7%
Applied egg-rr33.7%
exp-to-pow36.0%
pow1/236.0%
clear-num36.0%
sqrt-div37.3%
metadata-eval37.3%
associate-/r*37.3%
div-inv37.3%
metadata-eval37.3%
Applied egg-rr37.3%
Final simplification37.3%
(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%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod86.4%
frac-times86.3%
Applied egg-rr86.5%
Taylor expanded in k around 0 36.0%
*-commutative36.0%
associate-*r*36.0%
*-commutative36.0%
Simplified36.0%
Taylor expanded in n around 0 36.0%
associate-/l*36.0%
associate-/r/36.0%
Simplified36.0%
Taylor expanded in n around 0 36.0%
*-commutative36.0%
associate-*l/36.0%
*-commutative36.0%
Simplified36.0%
Final simplification36.0%
(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%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod86.4%
frac-times86.3%
Applied egg-rr86.5%
Taylor expanded in k around 0 36.0%
*-commutative36.0%
associate-*r*36.0%
*-commutative36.0%
Simplified36.0%
Taylor expanded in n around 0 36.0%
associate-/l*36.0%
associate-/r/36.0%
Simplified36.0%
Final simplification36.0%
(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%
*-commutative99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
add-sqr-sqrt99.3%
sqrt-unprod86.4%
frac-times86.3%
Applied egg-rr86.5%
Taylor expanded in k around 0 36.0%
*-commutative36.0%
associate-*r*36.0%
*-commutative36.0%
Simplified36.0%
Taylor expanded in n around 0 36.0%
associate-/l*36.0%
Simplified36.0%
Final simplification36.0%
herbie shell --seed 2023285
(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))))