
(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 (if (<= k 6.8e-18) (/ 1.0 (/ (sqrt (/ k PI)) (sqrt (* n 2.0)))) (sqrt (/ (pow (* PI (* n 2.0)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 6.8e-18) {
tmp = 1.0 / (sqrt((k / ((double) M_PI))) / sqrt((n * 2.0)));
} else {
tmp = sqrt((pow((((double) M_PI) * (n * 2.0)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 6.8e-18) {
tmp = 1.0 / (Math.sqrt((k / Math.PI)) / Math.sqrt((n * 2.0)));
} else {
tmp = Math.sqrt((Math.pow((Math.PI * (n * 2.0)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 6.8e-18: tmp = 1.0 / (math.sqrt((k / math.pi)) / math.sqrt((n * 2.0))) else: tmp = math.sqrt((math.pow((math.pi * (n * 2.0)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 6.8e-18) tmp = Float64(1.0 / Float64(sqrt(Float64(k / pi)) / sqrt(Float64(n * 2.0)))); else tmp = sqrt(Float64((Float64(pi * Float64(n * 2.0)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 6.8e-18) tmp = 1.0 / (sqrt((k / pi)) / sqrt((n * 2.0))); else tmp = sqrt((((pi * (n * 2.0)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 6.8e-18], N[(1.0 / N[(N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(n * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.8 \cdot 10^{-18}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n \cdot 2}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 6.80000000000000002e-18Initial program 98.4%
Taylor expanded in k around 0 71.4%
*-commutative71.4%
associate-/l*71.5%
Simplified71.5%
pow171.5%
sqrt-unprod71.7%
associate-*r/71.7%
*-commutative71.7%
associate-*r/71.7%
*-commutative71.7%
associate-*r*71.7%
Applied egg-rr71.7%
unpow171.7%
associate-/l*71.7%
associate-/l*71.6%
Simplified71.6%
associate-*r/71.7%
associate-/l*71.7%
clear-num71.6%
sqrt-div72.2%
metadata-eval72.2%
associate-*r*72.2%
*-commutative72.2%
*-commutative72.2%
*-commutative72.2%
Applied egg-rr72.2%
*-commutative72.2%
associate-/r*72.2%
associate-/r*72.2%
Simplified72.2%
associate-/l/72.2%
sqrt-div99.2%
*-commutative99.2%
Applied egg-rr99.2%
if 6.80000000000000002e-18 < k Initial program 99.8%
add-sqr-sqrt99.8%
sqrt-unprod99.8%
*-commutative99.8%
associate-*r*99.8%
div-sub99.8%
metadata-eval99.8%
div-inv99.8%
*-commutative99.8%
Applied egg-rr99.8%
Simplified99.8%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* n 2.0)))) (/ (sqrt t_0) (* (pow t_0 (* 0.5 k)) (sqrt k)))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (n * 2.0);
return sqrt(t_0) / (pow(t_0, (0.5 * k)) * sqrt(k));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (n * 2.0);
return Math.sqrt(t_0) / (Math.pow(t_0, (0.5 * k)) * Math.sqrt(k));
}
def code(k, n): t_0 = math.pi * (n * 2.0) return math.sqrt(t_0) / (math.pow(t_0, (0.5 * k)) * math.sqrt(k))
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) return Float64(sqrt(t_0) / Float64((t_0 ^ Float64(0.5 * k)) * sqrt(k))) end
function tmp = code(k, n) t_0 = pi * (n * 2.0); tmp = sqrt(t_0) / ((t_0 ^ (0.5 * k)) * sqrt(k)); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(N[Power[t$95$0, N[(0.5 * k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(n \cdot 2\right)\\
\frac{\sqrt{t\_0}}{{t\_0}^{\left(0.5 \cdot k\right)} \cdot \sqrt{k}}
\end{array}
\end{array}
Initial program 99.2%
associate-*l/99.2%
*-un-lft-identity99.2%
associate-*r*99.2%
div-sub99.2%
metadata-eval99.2%
pow-div99.3%
pow1/299.3%
associate-/l/99.3%
div-inv99.3%
metadata-eval99.3%
Applied egg-rr99.3%
*-commutative99.3%
associate-*l*99.3%
*-commutative99.3%
*-commutative99.3%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
(FPCore (k n) :precision binary64 (if (<= k 5.2e+67) (/ 1.0 (/ (sqrt (/ k PI)) (sqrt (* n 2.0)))) (sqrt (* PI (+ -1.0 (fma 2.0 (/ n k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 5.2e+67) {
tmp = 1.0 / (sqrt((k / ((double) M_PI))) / sqrt((n * 2.0)));
} else {
tmp = sqrt((((double) M_PI) * (-1.0 + fma(2.0, (n / k), 1.0))));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 5.2e+67) tmp = Float64(1.0 / Float64(sqrt(Float64(k / pi)) / sqrt(Float64(n * 2.0)))); else tmp = sqrt(Float64(pi * Float64(-1.0 + fma(2.0, Float64(n / k), 1.0)))); end return tmp end
code[k_, n_] := If[LessEqual[k, 5.2e+67], N[(1.0 / N[(N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(n * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(Pi * N[(-1.0 + N[(2.0 * N[(n / k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.2 \cdot 10^{+67}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\frac{k}{\pi}}}{\sqrt{n \cdot 2}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\pi \cdot \left(-1 + \mathsf{fma}\left(2, \frac{n}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 5.2000000000000001e67Initial program 98.5%
Taylor expanded in k around 0 58.6%
*-commutative58.6%
associate-/l*58.6%
Simplified58.6%
pow158.6%
sqrt-unprod58.8%
associate-*r/58.8%
*-commutative58.8%
associate-*r/58.8%
*-commutative58.8%
associate-*r*58.8%
Applied egg-rr58.8%
unpow158.8%
associate-/l*58.8%
associate-/l*58.7%
Simplified58.7%
associate-*r/58.8%
associate-/l*58.8%
clear-num58.7%
sqrt-div59.2%
metadata-eval59.2%
associate-*r*59.2%
*-commutative59.2%
*-commutative59.2%
*-commutative59.2%
Applied egg-rr59.2%
*-commutative59.2%
associate-/r*59.2%
associate-/r*59.2%
Simplified59.2%
associate-/l/59.2%
sqrt-div80.6%
*-commutative80.6%
Applied egg-rr80.6%
if 5.2000000000000001e67 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
*-commutative2.7%
associate-/l*2.7%
Simplified2.7%
pow12.7%
sqrt-unprod2.7%
associate-*r/2.7%
*-commutative2.7%
associate-*r/2.7%
*-commutative2.7%
associate-*r*2.7%
Applied egg-rr2.7%
unpow12.7%
associate-/l*2.7%
associate-/l*2.7%
Simplified2.7%
expm1-log1p-u2.7%
expm1-undefine35.6%
associate-*r/35.6%
*-commutative35.6%
associate-/l*35.6%
Applied egg-rr35.6%
sub-neg35.6%
metadata-eval35.6%
+-commutative35.6%
log1p-undefine35.6%
rem-exp-log35.6%
+-commutative35.6%
fma-define35.6%
Simplified35.6%
(FPCore (k n) :precision binary64 (if (<= k 4.6e+67) (/ (sqrt (* n (* PI 2.0))) (sqrt k)) (sqrt (* PI (+ -1.0 (fma 2.0 (/ n k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 4.6e+67) {
tmp = sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
} else {
tmp = sqrt((((double) M_PI) * (-1.0 + fma(2.0, (n / k), 1.0))));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 4.6e+67) tmp = Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)); else tmp = sqrt(Float64(pi * Float64(-1.0 + fma(2.0, Float64(n / k), 1.0)))); end return tmp end
code[k_, n_] := If[LessEqual[k, 4.6e+67], N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(Pi * N[(-1.0 + N[(2.0 * N[(n / k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.6 \cdot 10^{+67}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\pi \cdot \left(-1 + \mathsf{fma}\left(2, \frac{n}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 4.5999999999999997e67Initial program 98.5%
Taylor expanded in k around 0 58.6%
*-commutative58.6%
associate-/l*58.6%
Simplified58.6%
pow158.6%
sqrt-unprod58.8%
associate-*r/58.8%
*-commutative58.8%
associate-*r/58.8%
*-commutative58.8%
associate-*r*58.8%
Applied egg-rr58.8%
unpow158.8%
associate-/l*58.8%
associate-/l*58.7%
Simplified58.7%
associate-*r/58.8%
associate-/l*58.8%
sqrt-div80.1%
add-sqr-sqrt79.8%
associate-/l*79.8%
pow1/279.8%
sqrt-pow179.9%
associate-*r*79.9%
*-commutative79.9%
*-commutative79.9%
*-commutative79.9%
metadata-eval79.9%
Applied egg-rr79.8%
associate-*r/79.8%
pow-sqr80.1%
metadata-eval80.1%
unpow1/280.1%
associate-*r*80.1%
*-commutative80.1%
*-commutative80.1%
Simplified80.1%
if 4.5999999999999997e67 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
*-commutative2.7%
associate-/l*2.7%
Simplified2.7%
pow12.7%
sqrt-unprod2.7%
associate-*r/2.7%
*-commutative2.7%
associate-*r/2.7%
*-commutative2.7%
associate-*r*2.7%
Applied egg-rr2.7%
unpow12.7%
associate-/l*2.7%
associate-/l*2.7%
Simplified2.7%
expm1-log1p-u2.7%
expm1-undefine35.6%
associate-*r/35.6%
*-commutative35.6%
associate-/l*35.6%
Applied egg-rr35.6%
sub-neg35.6%
metadata-eval35.6%
+-commutative35.6%
log1p-undefine35.6%
rem-exp-log35.6%
+-commutative35.6%
fma-define35.6%
Simplified35.6%
(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.2%
associate-*l/99.2%
*-lft-identity99.2%
associate-*l*99.2%
div-sub99.2%
metadata-eval99.2%
Simplified99.2%
(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.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
pow135.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
unpow135.1%
associate-/l*35.1%
associate-/l*35.1%
Simplified35.1%
associate-*r/35.1%
associate-/l*35.1%
sqrt-div47.5%
add-sqr-sqrt47.3%
associate-/l*47.3%
pow1/247.3%
sqrt-pow147.3%
associate-*r*47.3%
*-commutative47.3%
*-commutative47.3%
*-commutative47.3%
metadata-eval47.3%
Applied egg-rr47.3%
associate-*r/47.3%
pow-sqr47.5%
metadata-eval47.5%
unpow1/247.5%
associate-*r*47.5%
*-commutative47.5%
*-commutative47.5%
Simplified47.5%
(FPCore (k n) :precision binary64 (* (sqrt (* n 2.0)) (sqrt (/ PI k))))
double code(double k, double n) {
return sqrt((n * 2.0)) * sqrt((((double) M_PI) / k));
}
public static double code(double k, double n) {
return Math.sqrt((n * 2.0)) * Math.sqrt((Math.PI / k));
}
def code(k, n): return math.sqrt((n * 2.0)) * math.sqrt((math.pi / k))
function code(k, n) return Float64(sqrt(Float64(n * 2.0)) * sqrt(Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt((n * 2.0)) * sqrt((pi / k)); end
code[k_, n_] := N[(N[Sqrt[N[(n * 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot 2} \cdot \sqrt{\frac{\pi}{k}}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
*-commutative35.1%
associate-/l*35.1%
*-commutative35.1%
Applied egg-rr35.1%
*-commutative35.1%
sqrt-prod47.5%
*-commutative47.5%
Applied egg-rr47.5%
Final simplification47.5%
(FPCore (k n) :precision binary64 (* (sqrt (* PI (/ 2.0 k))) (sqrt n)))
double code(double k, double n) {
return sqrt((((double) M_PI) * (2.0 / k))) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (2.0 / k))) * Math.sqrt(n);
}
def code(k, n): return math.sqrt((math.pi * (2.0 / k))) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(pi * Float64(2.0 / k))) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt((pi * (2.0 / k))) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
*-commutative35.1%
associate-/l*35.1%
*-commutative35.1%
Applied egg-rr35.1%
*-commutative35.1%
associate-*l*35.1%
metadata-eval35.1%
times-frac35.1%
*-commutative35.1%
*-un-lft-identity35.1%
associate-*r/35.1%
*-commutative35.1%
sqrt-prod47.4%
Applied egg-rr47.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(Float64(pi * 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[(N[(Pi * 2.0), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{\frac{\pi \cdot 2}{k}}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
*-commutative35.1%
associate-/l*35.1%
*-commutative35.1%
Applied egg-rr35.1%
*-commutative35.1%
associate-*l*35.1%
metadata-eval35.1%
times-frac35.1%
*-commutative35.1%
*-un-lft-identity35.1%
associate-*r/35.1%
sqrt-prod47.4%
Applied egg-rr47.4%
associate-*r/47.4%
Simplified47.4%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (* (/ k PI) (/ 1.0 n)) 2.0))))
double code(double k, double n) {
return 1.0 / sqrt((((k / ((double) M_PI)) * (1.0 / n)) / 2.0));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt((((k / Math.PI) * (1.0 / n)) / 2.0));
}
def code(k, n): return 1.0 / math.sqrt((((k / math.pi) * (1.0 / n)) / 2.0))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(Float64(k / pi) * Float64(1.0 / n)) / 2.0))) end
function tmp = code(k, n) tmp = 1.0 / sqrt((((k / pi) * (1.0 / n)) / 2.0)); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(N[(k / Pi), $MachinePrecision] * N[(1.0 / n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{\frac{k}{\pi} \cdot \frac{1}{n}}{2}}}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
pow135.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
unpow135.1%
associate-/l*35.1%
associate-/l*35.1%
Simplified35.1%
associate-*r/35.1%
associate-/l*35.1%
clear-num35.1%
sqrt-div35.4%
metadata-eval35.4%
associate-*r*35.4%
*-commutative35.4%
*-commutative35.4%
*-commutative35.4%
Applied egg-rr35.4%
*-commutative35.4%
associate-/r*35.3%
associate-/r*35.3%
Simplified35.3%
div-inv35.4%
Applied egg-rr35.4%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (/ k 2.0) (* PI n)))))
double code(double k, double n) {
return 1.0 / sqrt(((k / 2.0) / (((double) M_PI) * n)));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt(((k / 2.0) / (Math.PI * n)));
}
def code(k, n): return 1.0 / math.sqrt(((k / 2.0) / (math.pi * n)))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(k / 2.0) / Float64(pi * n)))) end
function tmp = code(k, n) tmp = 1.0 / sqrt(((k / 2.0) / (pi * n))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(k / 2.0), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{\frac{k}{2}}{\pi \cdot n}}}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
pow135.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
unpow135.1%
associate-/l*35.1%
associate-/l*35.1%
Simplified35.1%
associate-*r/35.1%
associate-/l*35.1%
clear-num35.1%
sqrt-div35.4%
metadata-eval35.4%
associate-*r*35.4%
*-commutative35.4%
*-commutative35.4%
*-commutative35.4%
Applied egg-rr35.4%
associate-/r*35.4%
*-commutative35.4%
Simplified35.4%
Final simplification35.4%
(FPCore (k n) :precision binary64 (sqrt (/ (* n 2.0) (/ k PI))))
double code(double k, double n) {
return sqrt(((n * 2.0) / (k / ((double) M_PI))));
}
public static double code(double k, double n) {
return Math.sqrt(((n * 2.0) / (k / Math.PI)));
}
def code(k, n): return math.sqrt(((n * 2.0) / (k / math.pi)))
function code(k, n) return sqrt(Float64(Float64(n * 2.0) / Float64(k / pi))) end
function tmp = code(k, n) tmp = sqrt(((n * 2.0) / (k / pi))); end
code[k_, n_] := N[Sqrt[N[(N[(n * 2.0), $MachinePrecision] / N[(k / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n \cdot 2}{\frac{k}{\pi}}}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
*-commutative35.1%
associate-/l*35.1%
*-commutative35.1%
Applied egg-rr35.1%
clear-num35.1%
un-div-inv35.1%
*-commutative35.1%
Applied egg-rr35.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(Float64(n * 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), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(n \cdot 2\right) \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
*-commutative35.1%
associate-/l*35.1%
*-commutative35.1%
Applied egg-rr35.1%
Final simplification35.1%
(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(Float64(n * 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), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \frac{n \cdot 2}{k}}
\end{array}
Initial program 99.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
pow135.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
unpow135.1%
associate-/l*35.1%
Simplified35.1%
(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.2%
Taylor expanded in k around 0 35.0%
*-commutative35.0%
associate-/l*35.0%
Simplified35.0%
pow135.0%
sqrt-unprod35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r/35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
unpow135.1%
associate-/l*35.1%
associate-/l*35.1%
Simplified35.1%
herbie shell --seed 2024101
(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))))