
(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 14 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 2e-29) (* (sqrt (* 2.0 n)) (sqrt (/ PI k))) (/ 1.0 (sqrt (* k (pow (* PI (* 2.0 n)) (+ k -1.0)))))))
double code(double k, double n) {
double tmp;
if (k <= 2e-29) {
tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
} else {
tmp = 1.0 / sqrt((k * pow((((double) M_PI) * (2.0 * n)), (k + -1.0))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2e-29) {
tmp = Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
} else {
tmp = 1.0 / Math.sqrt((k * Math.pow((Math.PI * (2.0 * n)), (k + -1.0))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2e-29: tmp = math.sqrt((2.0 * n)) * math.sqrt((math.pi / k)) else: tmp = 1.0 / math.sqrt((k * math.pow((math.pi * (2.0 * n)), (k + -1.0)))) return tmp
function code(k, n) tmp = 0.0 if (k <= 2e-29) tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))); else tmp = Float64(1.0 / sqrt(Float64(k * (Float64(pi * Float64(2.0 * n)) ^ Float64(k + -1.0))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2e-29) tmp = sqrt((2.0 * n)) * sqrt((pi / k)); else tmp = 1.0 / sqrt((k * ((pi * (2.0 * n)) ^ (k + -1.0)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2e-29], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k * N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(k + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{k \cdot {\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(k + -1\right)}}}\\
\end{array}
\end{array}
if k < 1.99999999999999989e-29Initial program 99.3%
Taylor expanded in k around 0 78.7%
*-commutative78.7%
associate-/l*78.7%
Simplified78.7%
*-commutative78.7%
sqrt-unprod79.0%
Applied egg-rr79.0%
associate-*r/79.0%
associate-*l/79.0%
associate-*r*79.0%
*-commutative79.0%
associate-*r*79.0%
metadata-eval79.0%
div-inv79.0%
sqrt-prod99.5%
div-inv99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 1.99999999999999989e-29 < k Initial program 99.9%
Taylor expanded in k around 0 99.9%
Applied egg-rr99.9%
div-inv99.9%
pow-flip99.9%
*-commutative99.9%
*-commutative99.9%
Applied egg-rr99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
metadata-eval99.9%
Simplified99.9%
add-sqr-sqrt99.9%
unpow-prod-down99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
Applied egg-rr99.9%
pow-sqr99.9%
metadata-eval99.9%
unpow-199.9%
Simplified99.9%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 2e-33) (* (sqrt (* 2.0 n)) (sqrt (/ PI k))) (pow (* k (pow (* (* 2.0 PI) n) (+ k -1.0))) -0.5)))
double code(double k, double n) {
double tmp;
if (k <= 2e-33) {
tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
} else {
tmp = pow((k * pow(((2.0 * ((double) M_PI)) * n), (k + -1.0))), -0.5);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2e-33) {
tmp = Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
} else {
tmp = Math.pow((k * Math.pow(((2.0 * Math.PI) * n), (k + -1.0))), -0.5);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2e-33: tmp = math.sqrt((2.0 * n)) * math.sqrt((math.pi / k)) else: tmp = math.pow((k * math.pow(((2.0 * math.pi) * n), (k + -1.0))), -0.5) return tmp
function code(k, n) tmp = 0.0 if (k <= 2e-33) tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))); else tmp = Float64(k * (Float64(Float64(2.0 * pi) * n) ^ Float64(k + -1.0))) ^ -0.5; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2e-33) tmp = sqrt((2.0 * n)) * sqrt((pi / k)); else tmp = (k * (((2.0 * pi) * n) ^ (k + -1.0))) ^ -0.5; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2e-33], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(k * N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(k + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-33}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(k \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(k + -1\right)}\right)}^{-0.5}\\
\end{array}
\end{array}
if k < 2.0000000000000001e-33Initial program 99.3%
Taylor expanded in k around 0 78.7%
*-commutative78.7%
associate-/l*78.7%
Simplified78.7%
*-commutative78.7%
sqrt-unprod79.0%
Applied egg-rr79.0%
associate-*r/79.0%
associate-*l/79.0%
associate-*r*79.0%
*-commutative79.0%
associate-*r*79.0%
metadata-eval79.0%
div-inv79.0%
sqrt-prod99.5%
div-inv99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 2.0000000000000001e-33 < k Initial program 99.9%
Taylor expanded in k around 0 99.9%
Applied egg-rr99.9%
div-inv99.9%
pow-flip99.9%
*-commutative99.9%
*-commutative99.9%
Applied egg-rr99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 4e-17) (* (sqrt (* 2.0 n)) (sqrt (/ PI k))) (sqrt (/ (pow (* (* 2.0 PI) n) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 4e-17) {
tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / 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 <= 4e-17) {
tmp = Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / 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 <= 4e-17: tmp = math.sqrt((2.0 * n)) * math.sqrt((math.pi / 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 <= 4e-17) tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))); else tmp = sqrt(Float64((Float64(Float64(2.0 * pi) * n) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4e-17) tmp = sqrt((2.0 * n)) * sqrt((pi / k)); else tmp = sqrt(((((2.0 * pi) * n) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4e-17], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(N[(2.0 * Pi), $MachinePrecision] * n), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 4.00000000000000029e-17Initial program 99.3%
Taylor expanded in k around 0 79.1%
*-commutative79.1%
associate-/l*79.0%
Simplified79.0%
*-commutative79.0%
sqrt-unprod79.4%
Applied egg-rr79.4%
associate-*r/79.4%
associate-*l/79.4%
associate-*r*79.4%
*-commutative79.4%
associate-*r*79.4%
metadata-eval79.4%
div-inv79.4%
sqrt-prod99.5%
div-inv99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 4.00000000000000029e-17 < k Initial program 99.9%
add-sqr-sqrt99.9%
sqrt-unprod99.9%
*-commutative99.9%
associate-*r*99.9%
div-sub99.9%
metadata-eval99.9%
div-inv99.9%
*-commutative99.9%
Applied egg-rr99.9%
Simplified99.9%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 5.4e+78) (* (sqrt (* 2.0 n)) (sqrt (/ PI k))) (sqrt (+ 1.0 (fma PI (* 2.0 (/ n k)) -1.0)))))
double code(double k, double n) {
double tmp;
if (k <= 5.4e+78) {
tmp = sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
} else {
tmp = sqrt((1.0 + fma(((double) M_PI), (2.0 * (n / k)), -1.0)));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 5.4e+78) tmp = Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))); else tmp = sqrt(Float64(1.0 + fma(pi, Float64(2.0 * Float64(n / k)), -1.0))); end return tmp end
code[k_, n_] := If[LessEqual[k, 5.4e+78], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(1.0 + N[(Pi * N[(2.0 * N[(n / k), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.4 \cdot 10^{+78}:\\
\;\;\;\;\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + \mathsf{fma}\left(\pi, 2 \cdot \frac{n}{k}, -1\right)}\\
\end{array}
\end{array}
if k < 5.40000000000000009e78Initial program 99.4%
Taylor expanded in k around 0 59.0%
*-commutative59.0%
associate-/l*59.0%
Simplified59.0%
*-commutative59.0%
sqrt-unprod59.2%
Applied egg-rr59.2%
associate-*r/59.2%
associate-*l/59.2%
associate-*r*59.2%
*-commutative59.2%
associate-*r*59.2%
metadata-eval59.2%
div-inv59.2%
sqrt-prod74.0%
div-inv74.0%
metadata-eval74.0%
Applied egg-rr74.0%
if 5.40000000000000009e78 < 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%
Taylor expanded in k around 0 2.6%
associate-*r/2.6%
associate-*r*2.6%
*-commutative2.6%
associate-*l*2.6%
*-commutative2.6%
associate-/l*2.6%
Simplified2.6%
clear-num2.6%
un-div-inv2.6%
*-un-lft-identity2.6%
*-commutative2.6%
times-frac2.6%
metadata-eval2.6%
Applied egg-rr2.6%
associate-/r*2.6%
Simplified2.6%
associate-/r/2.6%
associate-*l/2.6%
div-inv2.6%
metadata-eval2.6%
associate-*r*2.6%
*-commutative2.6%
associate-*r/2.6%
expm1-log1p-u2.6%
associate-*r*2.6%
expm1-undefine27.5%
Applied egg-rr27.5%
log1p-undefine27.5%
rem-exp-log27.5%
associate-+r-27.5%
fma-neg27.5%
metadata-eval27.5%
*-rgt-identity27.5%
times-frac27.5%
metadata-eval27.5%
*-commutative27.5%
Simplified27.5%
Final simplification57.3%
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return sqrt((1.0 / k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / k)) * Math.pow(((2.0 * Math.PI) * n), ((1.0 - k) / 2.0));
}
def code(k, n): return math.sqrt((1.0 / k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))
function code(k, n) return Float64(sqrt(Float64(1.0 / k)) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / 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}
\\
\sqrt{\frac{1}{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 99.7%
(FPCore (k n) :precision binary64 (* (pow (* 2.0 (* PI n)) (- 0.5 (* k 0.5))) (pow k -0.5)))
double code(double k, double n) {
return pow((2.0 * (((double) M_PI) * n)), (0.5 - (k * 0.5))) * pow(k, -0.5);
}
public static double code(double k, double n) {
return Math.pow((2.0 * (Math.PI * n)), (0.5 - (k * 0.5))) * Math.pow(k, -0.5);
}
def code(k, n): return math.pow((2.0 * (math.pi * n)), (0.5 - (k * 0.5))) * math.pow(k, -0.5)
function code(k, n) return Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 - Float64(k * 0.5))) * (k ^ -0.5)) end
function tmp = code(k, n) tmp = ((2.0 * (pi * n)) ^ (0.5 - (k * 0.5))) * (k ^ -0.5); end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot {k}^{-0.5}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
div-inv99.6%
div-inv99.6%
metadata-eval99.6%
pow1/299.6%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
(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.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
(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.6%
Taylor expanded in k around 0 38.7%
*-commutative38.7%
associate-/l*38.7%
Simplified38.7%
*-commutative38.7%
sqrt-unprod38.9%
Applied egg-rr38.9%
associate-*r/38.9%
associate-*l/38.9%
associate-*r*38.9%
*-commutative38.9%
associate-*r*38.9%
metadata-eval38.9%
div-inv38.9%
sqrt-prod48.3%
div-inv48.3%
metadata-eval48.3%
Applied egg-rr48.3%
Final simplification48.3%
(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.6%
add-sqr-sqrt99.4%
sqrt-unprod90.1%
*-commutative90.1%
associate-*r*90.1%
div-sub90.1%
metadata-eval90.1%
div-inv90.1%
*-commutative90.1%
Applied egg-rr90.2%
Simplified90.3%
Taylor expanded in k around 0 38.9%
associate-*r/38.9%
associate-*r*38.9%
*-commutative38.9%
associate-*l*38.9%
*-commutative38.9%
associate-/l*38.9%
Simplified38.9%
sqrt-prod48.3%
*-commutative48.3%
*-un-lft-identity48.3%
times-frac48.3%
metadata-eval48.3%
Applied egg-rr48.3%
associate-*r/48.3%
*-commutative48.3%
associate-*r/48.3%
Simplified48.3%
(FPCore (k n) :precision binary64 (pow (/ (* k 0.5) (* PI n)) -0.5))
double code(double k, double n) {
return pow(((k * 0.5) / (((double) M_PI) * n)), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k * 0.5) / (Math.PI * n)), -0.5);
}
def code(k, n): return math.pow(((k * 0.5) / (math.pi * n)), -0.5)
function code(k, n) return Float64(Float64(k * 0.5) / Float64(pi * n)) ^ -0.5 end
function tmp = code(k, n) tmp = ((k * 0.5) / (pi * n)) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k * 0.5), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k \cdot 0.5}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 99.7%
Applied egg-rr91.1%
Taylor expanded in k around 0 39.6%
associate-*r/39.6%
*-commutative39.6%
Simplified39.6%
Final simplification39.6%
(FPCore (k n) :precision binary64 (pow (* k (/ (/ 0.5 n) PI)) -0.5))
double code(double k, double n) {
return pow((k * ((0.5 / n) / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k * ((0.5 / n) / Math.PI)), -0.5);
}
def code(k, n): return math.pow((k * ((0.5 / n) / math.pi)), -0.5)
function code(k, n) return Float64(k * Float64(Float64(0.5 / n) / pi)) ^ -0.5 end
function tmp = code(k, n) tmp = (k * ((0.5 / n) / pi)) ^ -0.5; end
code[k_, n_] := N[Power[N[(k * N[(N[(0.5 / n), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{\frac{0.5}{n}}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 99.7%
Applied egg-rr91.1%
div-inv91.0%
pow-flip91.0%
*-commutative91.0%
*-commutative91.0%
Applied egg-rr91.0%
associate-*r*91.0%
*-commutative91.0%
*-commutative91.0%
sub-neg91.0%
+-commutative91.0%
distribute-neg-in91.0%
remove-double-neg91.0%
metadata-eval91.0%
Simplified91.0%
Taylor expanded in k around 0 39.6%
associate-/r*39.6%
Simplified39.6%
(FPCore (k n) :precision binary64 (pow (* k (/ 0.5 (* PI n))) -0.5))
double code(double k, double n) {
return pow((k * (0.5 / (((double) M_PI) * n))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k * (0.5 / (Math.PI * n))), -0.5);
}
def code(k, n): return math.pow((k * (0.5 / (math.pi * n))), -0.5)
function code(k, n) return Float64(k * Float64(0.5 / Float64(pi * n))) ^ -0.5 end
function tmp = code(k, n) tmp = (k * (0.5 / (pi * n))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k * N[(0.5 / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{0.5}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 99.7%
Applied egg-rr91.1%
div-inv91.0%
pow-flip91.0%
*-commutative91.0%
*-commutative91.0%
Applied egg-rr91.0%
associate-*r*91.0%
*-commutative91.0%
*-commutative91.0%
sub-neg91.0%
+-commutative91.0%
distribute-neg-in91.0%
remove-double-neg91.0%
metadata-eval91.0%
Simplified91.0%
Taylor expanded in k around 0 39.6%
Final simplification39.6%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ PI (/ k n)))))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) / (k / n))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI / (k / n))));
}
def code(k, n): return math.sqrt((2.0 * (math.pi / (k / n))))
function code(k, n) return sqrt(Float64(2.0 * Float64(pi / Float64(k / n)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi / (k / n)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(Pi / N[(k / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi}{\frac{k}{n}}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 38.7%
*-commutative38.7%
associate-/l*38.7%
Simplified38.7%
*-commutative38.7%
sqrt-unprod38.9%
Applied egg-rr38.9%
clear-num38.9%
un-div-inv38.9%
Applied egg-rr38.9%
(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.6%
Taylor expanded in k around 0 38.7%
*-commutative38.7%
associate-/l*38.7%
Simplified38.7%
*-commutative38.7%
sqrt-unprod38.9%
Applied egg-rr38.9%
herbie shell --seed 2024097
(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))))