
(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 (if (<= k 5.6e-39) (/ (sqrt (* n (* PI 2.0))) (sqrt k)) (/ 1.0 (sqrt (/ k (pow (* PI (* 2.0 n)) (- 1.0 k)))))))
double code(double k, double n) {
double tmp;
if (k <= 5.6e-39) {
tmp = sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
} 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 <= 5.6e-39) {
tmp = Math.sqrt((n * (Math.PI * 2.0))) / Math.sqrt(k);
} 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 <= 5.6e-39: tmp = math.sqrt((n * (math.pi * 2.0))) / math.sqrt(k) 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 <= 5.6e-39) tmp = Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)); 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 <= 5.6e-39) tmp = sqrt((n * (pi * 2.0))) / sqrt(k); else tmp = 1.0 / sqrt((k / ((pi * (2.0 * n)) ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 5.6e-39], N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $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 5.6 \cdot 10^{-39}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\
\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 < 5.6000000000000003e-39Initial program 99.3%
add-sqr-sqrt98.9%
sqrt-unprod70.8%
associate-*l/70.8%
*-un-lft-identity70.8%
associate-*l/71.0%
*-un-lft-identity71.0%
frac-times70.8%
Applied egg-rr70.8%
Simplified71.1%
Taylor expanded in k around 0 71.1%
*-commutative71.1%
*-commutative71.1%
*-commutative71.1%
associate-*r*71.1%
*-commutative71.1%
Simplified71.1%
sqrt-div99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
sqrt-prod99.2%
*-commutative99.2%
frac-2neg99.2%
div-inv99.1%
*-commutative99.1%
sqrt-prod99.3%
*-commutative99.3%
Applied egg-rr99.3%
*-commutative99.3%
neg-mul-199.3%
associate-/r*99.3%
metadata-eval99.3%
/-rgt-identity99.3%
distribute-neg-frac99.3%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
*-rgt-identity99.4%
associate-*r*99.4%
*-commutative99.4%
Simplified99.4%
if 5.6000000000000003e-39 < 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%
associate-*r*99.6%
sqrt-pow199.6%
*-commutative99.6%
associate-*r*99.6%
*-commutative99.6%
sqrt-prod99.7%
div-inv99.7%
clear-num99.7%
sqrt-div99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 3.2e-39) (/ (sqrt (* n (* PI 2.0))) (sqrt k)) (sqrt (/ (pow (* PI (* 2.0 n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 3.2e-39) {
tmp = sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
} 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 <= 3.2e-39) {
tmp = Math.sqrt((n * (Math.PI * 2.0))) / Math.sqrt(k);
} 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 <= 3.2e-39: tmp = math.sqrt((n * (math.pi * 2.0))) / math.sqrt(k) 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 <= 3.2e-39) tmp = Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)); 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 <= 3.2e-39) tmp = sqrt((n * (pi * 2.0))) / sqrt(k); else tmp = sqrt((((pi * (2.0 * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 3.2e-39], N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $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 3.2 \cdot 10^{-39}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 3.1999999999999998e-39Initial program 99.3%
add-sqr-sqrt98.9%
sqrt-unprod70.8%
associate-*l/70.8%
*-un-lft-identity70.8%
associate-*l/71.0%
*-un-lft-identity71.0%
frac-times70.8%
Applied egg-rr70.8%
Simplified71.1%
Taylor expanded in k around 0 71.1%
*-commutative71.1%
*-commutative71.1%
*-commutative71.1%
associate-*r*71.1%
*-commutative71.1%
Simplified71.1%
sqrt-div99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
sqrt-prod99.2%
*-commutative99.2%
frac-2neg99.2%
div-inv99.1%
*-commutative99.1%
sqrt-prod99.3%
*-commutative99.3%
Applied egg-rr99.3%
*-commutative99.3%
neg-mul-199.3%
associate-/r*99.3%
metadata-eval99.3%
/-rgt-identity99.3%
distribute-neg-frac99.3%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
*-rgt-identity99.4%
associate-*r*99.4%
*-commutative99.4%
Simplified99.4%
if 3.1999999999999998e-39 < k Initial program 99.6%
add-sqr-sqrt99.6%
sqrt-unprod99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
frac-times99.6%
Applied egg-rr99.6%
Simplified99.7%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (+ 0.5 (* -0.5 k))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), (0.5 + (-0.5 * k))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), (0.5 + (-0.5 * k))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), (0.5 + (-0.5 * k))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(0.5 + Float64(-0.5 * k))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ (0.5 + (-0.5 * k))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(0.5 + N[(-0.5 * k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 + -0.5 \cdot k\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
*-commutative99.6%
associate-*l*99.6%
div-sub99.6%
sub-neg99.6%
distribute-frac-neg99.6%
metadata-eval99.6%
neg-mul-199.6%
associate-/l*99.6%
associate-/r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 3.4e+137) (/ (sqrt (* n (* PI 2.0))) (sqrt k)) (pow (pow (* (/ PI k) (/ n 0.5)) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 3.4e+137) {
tmp = sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
} else {
tmp = pow(pow(((((double) M_PI) / k) * (n / 0.5)), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3.4e+137) {
tmp = Math.sqrt((n * (Math.PI * 2.0))) / Math.sqrt(k);
} else {
tmp = Math.pow(Math.pow(((Math.PI / k) * (n / 0.5)), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 3.4e+137: tmp = math.sqrt((n * (math.pi * 2.0))) / math.sqrt(k) else: tmp = math.pow(math.pow(((math.pi / k) * (n / 0.5)), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 3.4e+137) tmp = Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)); else tmp = (Float64(Float64(pi / k) * Float64(n / 0.5)) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 3.4e+137) tmp = sqrt((n * (pi * 2.0))) / sqrt(k); else tmp = (((pi / k) * (n / 0.5)) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 3.4e+137], N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(N[(Pi / k), $MachinePrecision] * N[(n / 0.5), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.4 \cdot 10^{+137}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\frac{\pi}{k} \cdot \frac{n}{0.5}\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 3.39999999999999986e137Initial program 99.2%
add-sqr-sqrt99.0%
sqrt-unprod82.8%
associate-*l/82.7%
*-un-lft-identity82.7%
associate-*l/82.9%
*-un-lft-identity82.9%
frac-times82.7%
Applied egg-rr82.8%
Simplified82.9%
Taylor expanded in k around 0 48.5%
*-commutative48.5%
*-commutative48.5%
*-commutative48.5%
associate-*r*48.5%
*-commutative48.5%
Simplified48.5%
sqrt-div64.9%
*-commutative64.9%
associate-*l*64.9%
*-commutative64.9%
sqrt-prod64.8%
*-commutative64.8%
frac-2neg64.8%
div-inv64.7%
*-commutative64.7%
sqrt-prod64.8%
*-commutative64.8%
Applied egg-rr64.8%
*-commutative64.8%
neg-mul-164.8%
associate-/r*64.8%
metadata-eval64.8%
/-rgt-identity64.8%
distribute-neg-frac64.8%
times-frac64.9%
neg-mul-164.9%
remove-double-neg64.9%
*-rgt-identity64.9%
associate-*r*64.9%
*-commutative64.9%
Simplified64.9%
if 3.39999999999999986e137 < k Initial program 100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
associate-*l/100.0%
*-un-lft-identity100.0%
associate-*l/100.0%
*-un-lft-identity100.0%
frac-times100.0%
Applied egg-rr100.0%
Simplified100.0%
Taylor expanded in k around 0 2.8%
*-commutative2.8%
*-commutative2.8%
*-commutative2.8%
associate-*r*2.8%
*-commutative2.8%
Simplified2.8%
Taylor expanded in n around 0 2.8%
associate-*r/2.8%
associate-*l*2.8%
*-commutative2.8%
associate-*l*2.8%
Simplified2.8%
pow1/22.8%
*-commutative2.8%
associate-*l*2.8%
associate-/r/2.7%
associate-/l*2.8%
metadata-eval2.8%
pow-pow5.3%
sqr-pow5.3%
pow-prod-down25.7%
pow-prod-up25.7%
metadata-eval25.7%
times-frac25.7%
*-un-lft-identity25.7%
*-commutative25.7%
*-commutative25.7%
times-frac25.7%
metadata-eval25.7%
metadata-eval25.7%
Applied egg-rr25.7%
times-frac25.7%
*-commutative25.7%
times-frac25.7%
Simplified25.7%
Final simplification53.4%
(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.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
Taylor expanded in n around 0 35.1%
associate-*r/35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*34.7%
Simplified34.7%
sqrt-prod46.0%
Applied egg-rr46.0%
associate-*r/46.0%
associate-/l*46.0%
associate-/r/46.0%
Simplified46.0%
Final simplification46.0%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 n)) (sqrt (/ PI k))))
double code(double k, double n) {
return sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
}
def code(k, n): return math.sqrt((2.0 * n)) * math.sqrt((math.pi / k))
function code(k, n) return Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt((2.0 * n)) * sqrt((pi / k)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
Taylor expanded in n around 0 35.1%
associate-*r/35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*34.7%
Simplified34.7%
pow1/234.7%
associate-*r*35.1%
unpow-prod-down46.7%
*-commutative46.7%
pow1/246.7%
Applied egg-rr46.7%
unpow1/246.7%
*-commutative46.7%
Simplified46.7%
Final simplification46.7%
(FPCore (k n) :precision binary64 (/ (sqrt (* n (* PI 2.0))) (sqrt k)))
double code(double k, double n) {
return sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((n * (Math.PI * 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((n * (math.pi * 2.0))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((n * (pi * 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
sqrt-div46.8%
*-commutative46.8%
associate-*l*46.8%
*-commutative46.8%
sqrt-prod46.7%
*-commutative46.7%
frac-2neg46.7%
div-inv46.6%
*-commutative46.6%
sqrt-prod46.7%
*-commutative46.7%
Applied egg-rr46.7%
*-commutative46.7%
neg-mul-146.7%
associate-/r*46.7%
metadata-eval46.7%
/-rgt-identity46.7%
distribute-neg-frac46.7%
times-frac46.8%
neg-mul-146.8%
remove-double-neg46.8%
*-rgt-identity46.8%
associate-*r*46.8%
*-commutative46.8%
Simplified46.8%
Final simplification46.8%
(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(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[(0.5 * N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(0.5 \cdot \frac{k}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
Taylor expanded in n around 0 35.1%
associate-*r/35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*34.7%
Simplified34.7%
*-commutative34.7%
associate-*r/34.7%
associate-*l/35.1%
associate-*r*35.1%
associate-*r/35.1%
metadata-eval35.1%
times-frac35.1%
*-un-lft-identity35.1%
*-commutative35.1%
clear-num35.1%
metadata-eval35.1%
metadata-eval35.1%
div-inv35.1%
*-commutative35.1%
add-sqr-sqrt35.0%
frac-times35.1%
Applied egg-rr35.1%
associate-/l/35.1%
Simplified35.1%
Final simplification35.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.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
Taylor expanded in n around 0 35.1%
associate-*r/35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*34.7%
Simplified34.7%
Final simplification34.7%
(FPCore (k n) :precision binary64 (sqrt (* n (* PI (/ 2.0 k)))))
double code(double k, double n) {
return sqrt((n * (((double) M_PI) * (2.0 / k))));
}
public static double code(double k, double n) {
return Math.sqrt((n * (Math.PI * (2.0 / k))));
}
def code(k, n): return math.sqrt((n * (math.pi * (2.0 / k))))
function code(k, n) return sqrt(Float64(n * Float64(pi * Float64(2.0 / k)))) end
function tmp = code(k, n) tmp = sqrt((n * (pi * (2.0 / k)))); end
code[k_, n_] := N[Sqrt[N[(n * N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \left(\pi \cdot \frac{2}{k}\right)}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
Taylor expanded in n around 0 35.1%
associate-*r/35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*l*34.7%
Simplified34.7%
Taylor expanded in n around 0 35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*l*35.1%
*-commutative35.1%
associate-*r/34.7%
associate-/l*34.7%
associate-/r/34.7%
Simplified34.7%
Final simplification34.7%
(FPCore (k n) :precision binary64 (sqrt (* (* PI 2.0) (/ n k))))
double code(double k, double n) {
return sqrt(((((double) M_PI) * 2.0) * (n / k)));
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI * 2.0) * (n / k)));
}
def code(k, n): return math.sqrt(((math.pi * 2.0) * (n / k)))
function code(k, n) return sqrt(Float64(Float64(pi * 2.0) * Float64(n / k))) end
function tmp = code(k, n) tmp = sqrt(((pi * 2.0) * (n / k))); end
code[k_, n_] := N[Sqrt[N[(N[(Pi * 2.0), $MachinePrecision] * N[(n / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(\pi \cdot 2\right) \cdot \frac{n}{k}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
associate-/l*35.1%
associate-/r/35.1%
Applied egg-rr35.1%
Final simplification35.1%
(FPCore (k n) :precision binary64 (sqrt (/ (* n (* PI 2.0)) k)))
double code(double k, double n) {
return sqrt(((n * (((double) M_PI) * 2.0)) / k));
}
public static double code(double k, double n) {
return Math.sqrt(((n * (Math.PI * 2.0)) / k));
}
def code(k, n): return math.sqrt(((n * (math.pi * 2.0)) / k))
function code(k, n) return sqrt(Float64(Float64(n * Float64(pi * 2.0)) / k)) end
function tmp = code(k, n) tmp = sqrt(((n * (pi * 2.0)) / k)); end
code[k_, n_] := N[Sqrt[N[(N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n \cdot \left(\pi \cdot 2\right)}{k}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod87.8%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-*l/87.9%
*-un-lft-identity87.9%
frac-times87.8%
Applied egg-rr87.8%
Simplified87.9%
Taylor expanded in k around 0 35.1%
*-commutative35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
Final simplification35.1%
herbie shell --seed 2023332
(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))))