
(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 15 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 (* k 0.5))) (sqrt k))))
double code(double k, double n) {
double t_0 = 2.0 * (n * ((double) M_PI));
return (sqrt(t_0) / pow(t_0, (k * 0.5))) / sqrt(k);
}
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, (k * 0.5))) / Math.sqrt(k);
}
def code(k, n): t_0 = 2.0 * (n * math.pi) return (math.sqrt(t_0) / math.pow(t_0, (k * 0.5))) / math.sqrt(k)
function code(k, n) t_0 = Float64(2.0 * Float64(n * pi)) return Float64(Float64(sqrt(t_0) / (t_0 ^ Float64(k * 0.5))) / sqrt(k)) end
function tmp = code(k, n) t_0 = 2.0 * (n * pi); tmp = (sqrt(t_0) / (t_0 ^ (k * 0.5))) / sqrt(k); 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[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(n \cdot \pi\right)\\
\frac{\frac{\sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)}}}{\sqrt{k}}
\end{array}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-un-lft-identity99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
*-rgt-identity99.7%
*-commutative99.7%
times-frac99.7%
associate-*l/99.7%
*-lft-identity99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* 2.0 n)))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = math.pi * (2.0 * n) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $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 := \pi \cdot \left(2 \cdot n\right)\\
\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.5%
*-un-lft-identity99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-/l/99.7%
unpow1/299.7%
metadata-eval99.7%
pow-sqr99.5%
fabs-sqr99.5%
pow-sqr99.7%
metadata-eval99.7%
unpow1/299.7%
fabs-neg99.7%
neg-mul-199.7%
rem-square-sqrt0.0%
unpow1/20.0%
metadata-eval0.0%
pow-sqr0.0%
unswap-sqr0.0%
fabs-sqr0.0%
unswap-sqr0.0%
rem-square-sqrt26.0%
pow-sqr26.0%
metadata-eval26.0%
unpow1/226.0%
Simplified99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* 2.0 n))))
(if (<= k 1e-65)
(/ (sqrt t_0) (sqrt k))
(sqrt (* (pow t_0 (- 1.0 k)) (/ 1.0 k))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
double tmp;
if (k <= 1e-65) {
tmp = sqrt(t_0) / sqrt(k);
} else {
tmp = sqrt((pow(t_0, (1.0 - k)) * (1.0 / k)));
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
double tmp;
if (k <= 1e-65) {
tmp = Math.sqrt(t_0) / Math.sqrt(k);
} else {
tmp = Math.sqrt((Math.pow(t_0, (1.0 - k)) * (1.0 / k)));
}
return tmp;
}
def code(k, n): t_0 = math.pi * (2.0 * n) tmp = 0 if k <= 1e-65: tmp = math.sqrt(t_0) / math.sqrt(k) else: tmp = math.sqrt((math.pow(t_0, (1.0 - k)) * (1.0 / k))) return tmp
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) tmp = 0.0 if (k <= 1e-65) tmp = Float64(sqrt(t_0) / sqrt(k)); else tmp = sqrt(Float64((t_0 ^ Float64(1.0 - k)) * Float64(1.0 / k))); end return tmp end
function tmp_2 = code(k, n) t_0 = pi * (2.0 * n); tmp = 0.0; if (k <= 1e-65) tmp = sqrt(t_0) / sqrt(k); else tmp = sqrt(((t_0 ^ (1.0 - k)) * (1.0 / k))); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1e-65], N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[t$95$0, N[(1.0 - k), $MachinePrecision]], $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\mathbf{if}\;k \leq 10^{-65}:\\
\;\;\;\;\frac{\sqrt{t\_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{t\_0}^{\left(1 - k\right)} \cdot \frac{1}{k}}\\
\end{array}
\end{array}
if k < 9.99999999999999923e-66Initial program 99.4%
Taylor expanded in k around 0 69.8%
*-commutative69.8%
associate-/l*69.9%
Simplified69.9%
pow169.9%
*-commutative69.9%
sqrt-unprod70.2%
Applied egg-rr70.2%
unpow170.2%
*-commutative70.2%
associate-*r*70.2%
*-commutative70.2%
Simplified70.2%
associate-*r/70.1%
*-commutative70.1%
associate-*r*70.1%
sqrt-div99.5%
associate-*r*99.5%
*-commutative99.5%
add-sqr-sqrt99.0%
*-un-lft-identity99.0%
times-frac99.1%
Applied egg-rr99.0%
/-rgt-identity99.0%
associate-*r/99.1%
pow-sqr99.5%
metadata-eval99.5%
unpow1/299.5%
*-commutative99.5%
Simplified99.5%
if 9.99999999999999923e-66 < k Initial program 99.5%
associate-*l/99.5%
*-un-lft-identity99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.9%
pow1/299.9%
associate-/l/99.9%
div-inv99.9%
metadata-eval99.9%
Applied egg-rr99.9%
*-rgt-identity99.9%
*-commutative99.9%
times-frac99.9%
associate-*l/99.9%
*-lft-identity99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.8%
sqrt-unprod99.3%
frac-times99.3%
Applied egg-rr98.9%
*-lft-identity98.9%
*-commutative98.9%
Simplified98.9%
div-inv98.9%
*-commutative98.9%
associate-*l*98.9%
Applied egg-rr98.9%
Final simplification99.2%
(FPCore (k n) :precision binary64 (if (<= k 5.5e-66) (/ (sqrt (* PI (* 2.0 n))) (sqrt k)) (sqrt (/ (pow (* 2.0 (* n PI)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 5.5e-66) {
tmp = sqrt((((double) M_PI) * (2.0 * n))) / 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 <= 5.5e-66) {
tmp = Math.sqrt((Math.PI * (2.0 * n))) / 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 <= 5.5e-66: tmp = math.sqrt((math.pi * (2.0 * n))) / 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 <= 5.5e-66) tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(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 <= 5.5e-66) tmp = sqrt((pi * (2.0 * n))) / sqrt(k); else tmp = sqrt((((2.0 * (n * pi)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 5.5e-66], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $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 5.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{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 < 5.50000000000000053e-66Initial program 99.4%
Taylor expanded in k around 0 69.8%
*-commutative69.8%
associate-/l*69.9%
Simplified69.9%
pow169.9%
*-commutative69.9%
sqrt-unprod70.2%
Applied egg-rr70.2%
unpow170.2%
*-commutative70.2%
associate-*r*70.2%
*-commutative70.2%
Simplified70.2%
associate-*r/70.1%
*-commutative70.1%
associate-*r*70.1%
sqrt-div99.5%
associate-*r*99.5%
*-commutative99.5%
add-sqr-sqrt99.0%
*-un-lft-identity99.0%
times-frac99.1%
Applied egg-rr99.0%
/-rgt-identity99.0%
associate-*r/99.1%
pow-sqr99.5%
metadata-eval99.5%
unpow1/299.5%
*-commutative99.5%
Simplified99.5%
if 5.50000000000000053e-66 < k Initial program 99.5%
Applied egg-rr98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
associate-*l*98.9%
metadata-eval98.9%
*-commutative98.9%
neg-mul-198.9%
sub-neg98.9%
*-commutative98.9%
Simplified98.9%
Final simplification99.2%
(FPCore (k n) :precision binary64 (if (<= k 1.22e+76) (/ (sqrt (* PI (* 2.0 n))) (sqrt k)) (sqrt (* PI (+ -1.0 (fma n (/ 2.0 k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 1.22e+76) {
tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
} else {
tmp = sqrt((((double) M_PI) * (-1.0 + fma(n, (2.0 / k), 1.0))));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.22e+76) tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k)); else tmp = sqrt(Float64(pi * Float64(-1.0 + fma(n, Float64(2.0 / k), 1.0)))); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.22e+76], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(Pi * N[(-1.0 + N[(n * N[(2.0 / k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.22 \cdot 10^{+76}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\pi \cdot \left(-1 + \mathsf{fma}\left(n, \frac{2}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 1.22000000000000002e76Initial program 99.1%
Taylor expanded in k around 0 63.1%
*-commutative63.1%
associate-/l*63.2%
Simplified63.2%
pow163.2%
*-commutative63.2%
sqrt-unprod63.4%
Applied egg-rr63.4%
unpow163.4%
*-commutative63.4%
associate-*r*63.4%
*-commutative63.4%
Simplified63.4%
associate-*r/63.4%
*-commutative63.4%
associate-*r*63.4%
sqrt-div83.3%
associate-*r*83.3%
*-commutative83.3%
add-sqr-sqrt82.9%
*-un-lft-identity82.9%
times-frac82.9%
Applied egg-rr82.9%
/-rgt-identity82.9%
associate-*r/83.0%
pow-sqr83.3%
metadata-eval83.3%
unpow1/283.3%
*-commutative83.3%
Simplified83.3%
if 1.22000000000000002e76 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
*-commutative2.7%
associate-/l*2.7%
Simplified2.7%
pow12.7%
*-commutative2.7%
sqrt-unprod2.7%
Applied egg-rr2.7%
unpow12.7%
*-commutative2.7%
associate-*r*2.7%
*-commutative2.7%
Simplified2.7%
Taylor expanded in n around 0 2.7%
associate-*r/2.7%
associate-*r*2.7%
associate-*l/2.7%
*-rgt-identity2.7%
associate-*r/2.7%
*-commutative2.7%
*-commutative2.7%
associate-*r*2.7%
associate-*l/2.7%
metadata-eval2.7%
Simplified2.7%
expm1-log1p-u2.7%
expm1-undefine39.8%
associate-*l/39.8%
*-un-lft-identity39.8%
times-frac39.8%
metadata-eval39.8%
Applied egg-rr39.8%
sub-neg39.8%
metadata-eval39.8%
+-commutative39.8%
log1p-undefine39.8%
rem-exp-log39.8%
+-commutative39.8%
associate-*r/39.8%
*-commutative39.8%
associate-/l*39.8%
fma-define39.8%
Simplified39.8%
Final simplification66.1%
(FPCore (k n) :precision binary64 (if (<= k 4.2e+246) (/ (sqrt (* PI (* 2.0 n))) (sqrt k)) (cbrt (pow (* 2.0 (/ (* n PI) k)) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 4.2e+246) {
tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
} else {
tmp = cbrt(pow((2.0 * ((n * ((double) M_PI)) / k)), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.2e+246) {
tmp = Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
} else {
tmp = Math.cbrt(Math.pow((2.0 * ((n * Math.PI) / k)), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 4.2e+246) tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k)); else tmp = cbrt((Float64(2.0 * Float64(Float64(n * pi) / k)) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 4.2e+246], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(N[(n * Pi), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.2 \cdot 10^{+246}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \frac{n \cdot \pi}{k}\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 4.2e246Initial program 99.4%
Taylor expanded in k around 0 44.5%
*-commutative44.5%
associate-/l*44.5%
Simplified44.5%
pow144.5%
*-commutative44.5%
sqrt-unprod44.7%
Applied egg-rr44.7%
unpow144.7%
*-commutative44.7%
associate-*r*44.7%
*-commutative44.7%
Simplified44.7%
associate-*r/44.7%
*-commutative44.7%
associate-*r*44.7%
sqrt-div58.5%
associate-*r*58.5%
*-commutative58.5%
add-sqr-sqrt58.2%
*-un-lft-identity58.2%
times-frac58.2%
Applied egg-rr58.2%
/-rgt-identity58.2%
associate-*r/58.2%
pow-sqr58.5%
metadata-eval58.5%
unpow1/258.5%
*-commutative58.5%
Simplified58.5%
if 4.2e246 < k Initial program 100.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
associate-/l*2.9%
Simplified2.9%
pow12.9%
*-commutative2.9%
sqrt-unprod2.9%
Applied egg-rr2.9%
unpow12.9%
*-commutative2.9%
associate-*r*2.9%
*-commutative2.9%
Simplified2.9%
add-cbrt-cube17.9%
add-sqr-sqrt17.9%
associate-*r/17.9%
*-commutative17.9%
associate-*r*17.9%
pow117.9%
pow1/217.9%
associate-*r/17.9%
*-commutative17.9%
associate-*r*17.9%
pow-prod-up17.9%
associate-/l*17.9%
*-commutative17.9%
metadata-eval17.9%
Applied egg-rr17.9%
Final simplification53.4%
(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.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (/ (sqrt (* PI (* 2.0 n))) (sqrt k)))
double code(double k, double n) {
return sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((pi * (2.0 * n))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
associate-*r/39.4%
*-commutative39.4%
associate-*r*39.4%
sqrt-div51.5%
associate-*r*51.5%
*-commutative51.5%
add-sqr-sqrt51.3%
*-un-lft-identity51.3%
times-frac51.3%
Applied egg-rr51.3%
/-rgt-identity51.3%
associate-*r/51.3%
pow-sqr51.5%
metadata-eval51.5%
unpow1/251.5%
*-commutative51.5%
Simplified51.5%
Final simplification51.5%
(FPCore (k n) :precision binary64 (* (sqrt (/ PI k)) (sqrt (* 2.0 n))))
double code(double k, double n) {
return sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
}
def code(k, n): return math.sqrt((math.pi / k)) * math.sqrt((2.0 * n))
function code(k, n) return Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))) end
function tmp = code(k, n) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); end
code[k_, n_] := N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
*-commutative39.5%
*-commutative39.5%
sqrt-prod51.5%
Applied egg-rr51.5%
*-commutative51.5%
Simplified51.5%
Final simplification51.5%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 (/ PI k))) (sqrt n)))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(n);
}
def code(k, n): return math.sqrt((2.0 * (math.pi / k))) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
sqrt-prod51.5%
*-commutative51.5%
sqrt-prod51.4%
associate-*r*51.4%
*-commutative51.4%
associate-*r*51.5%
sqrt-unprod51.5%
Applied egg-rr51.5%
(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%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
associate-*l*39.5%
sqrt-prod51.5%
Applied egg-rr51.5%
*-commutative51.5%
associate-*l/51.5%
associate-/l*51.5%
Simplified51.5%
(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(Float64(k / 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[(N[(k / Pi), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(0.5 \cdot \frac{\frac{k}{\pi}}{n}\right)}^{-0.5}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
associate-*r/39.4%
*-commutative39.4%
associate-*r*39.4%
clear-num39.4%
sqrt-div39.9%
metadata-eval39.9%
*-un-lft-identity39.9%
times-frac39.9%
metadata-eval39.9%
*-commutative39.9%
Applied egg-rr39.9%
associate-*r/39.9%
*-commutative39.9%
times-frac39.8%
Simplified39.8%
*-un-lft-identity39.8%
inv-pow39.8%
sqrt-pow239.9%
*-commutative39.9%
frac-times39.9%
*-un-lft-identity39.9%
times-frac39.9%
metadata-eval39.9%
*-commutative39.9%
metadata-eval39.9%
Applied egg-rr39.9%
*-lft-identity39.9%
associate-/r*40.0%
Simplified40.0%
(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(Float64(2.0 * n) * Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * n) * (pi / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * n), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot n\right) \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
Final simplification39.5%
(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(pi * Float64(Float64(2.0 * n) / k))) end
function tmp = code(k, n) tmp = sqrt((pi * ((2.0 * n) / k))); end
code[k_, n_] := N[Sqrt[N[(Pi * N[(N[(2.0 * n), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \frac{2 \cdot n}{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
Taylor expanded in n around 0 39.4%
associate-*r/39.4%
*-commutative39.4%
associate-*l/39.4%
metadata-eval39.4%
associate-*r/39.4%
*-commutative39.4%
associate-*l*39.5%
associate-*r/39.5%
metadata-eval39.5%
associate-*r/39.5%
Simplified39.5%
Final simplification39.5%
(FPCore (k n) :precision binary64 (sqrt (* PI (* n (/ 2.0 k)))))
double code(double k, double n) {
return sqrt((((double) M_PI) * (n * (2.0 / k))));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (n * (2.0 / k))));
}
def code(k, n): return math.sqrt((math.pi * (n * (2.0 / k))))
function code(k, n) return sqrt(Float64(pi * Float64(n * Float64(2.0 / k)))) end
function tmp = code(k, n) tmp = sqrt((pi * (n * (2.0 / k)))); end
code[k_, n_] := N[Sqrt[N[(Pi * N[(n * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \left(n \cdot \frac{2}{k}\right)}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.3%
*-commutative39.3%
associate-/l*39.3%
Simplified39.3%
pow139.3%
*-commutative39.3%
sqrt-unprod39.5%
Applied egg-rr39.5%
unpow139.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
Taylor expanded in n around 0 39.4%
associate-*r/39.4%
associate-*r*39.4%
associate-*l/39.5%
*-rgt-identity39.5%
associate-*r/39.5%
*-commutative39.5%
*-commutative39.5%
associate-*r*39.5%
associate-*l/39.5%
metadata-eval39.5%
Simplified39.5%
Final simplification39.5%
herbie shell --seed 2024166
(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))))