
(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 11 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 (* PI n)))) (/ (* (pow t_0 (* k -0.5)) (sqrt t_0)) (sqrt k))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return (pow(t_0, (k * -0.5)) * sqrt(t_0)) / sqrt(k);
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI * n);
return (Math.pow(t_0, (k * -0.5)) * Math.sqrt(t_0)) / Math.sqrt(k);
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.pow(t_0, (k * -0.5)) * math.sqrt(t_0)) / math.sqrt(k)
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64((t_0 ^ Float64(k * -0.5)) * sqrt(t_0)) / sqrt(k)) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = ((t_0 ^ (k * -0.5)) * sqrt(t_0)) / sqrt(k); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[t$95$0, N[(k * -0.5), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{{t_0}^{\left(k \cdot -0.5\right)} \cdot \sqrt{t_0}}{\sqrt{k}}
\end{array}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-lft-identity99.5%
*-commutative99.5%
associate-*l*99.5%
div-sub99.5%
sub-neg99.5%
distribute-frac-neg99.5%
metadata-eval99.5%
neg-mul-199.5%
associate-/l*99.5%
associate-/r/99.5%
metadata-eval99.5%
Simplified99.5%
+-commutative99.5%
unpow-prod-up99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
pow1/299.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* 2.0 n))))
(if (<= k 2e-27)
(* (pow k -0.5) (sqrt t_0))
(/ 1.0 (sqrt (/ k (pow t_0 (- 1.0 k))))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
double tmp;
if (k <= 2e-27) {
tmp = pow(k, -0.5) * sqrt(t_0);
} else {
tmp = 1.0 / sqrt((k / pow(t_0, (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 <= 2e-27) {
tmp = Math.pow(k, -0.5) * Math.sqrt(t_0);
} else {
tmp = 1.0 / Math.sqrt((k / Math.pow(t_0, (1.0 - k))));
}
return tmp;
}
def code(k, n): t_0 = math.pi * (2.0 * n) tmp = 0 if k <= 2e-27: tmp = math.pow(k, -0.5) * math.sqrt(t_0) else: tmp = 1.0 / math.sqrt((k / math.pow(t_0, (1.0 - k)))) return tmp
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) tmp = 0.0 if (k <= 2e-27) tmp = Float64((k ^ -0.5) * sqrt(t_0)); else tmp = Float64(1.0 / sqrt(Float64(k / (t_0 ^ 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 <= 2e-27) tmp = (k ^ -0.5) * sqrt(t_0); else tmp = 1.0 / sqrt((k / (t_0 ^ (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, 2e-27], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k / N[Power[t$95$0, N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\mathbf{if}\;k \leq 2 \cdot 10^{-27}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{{t_0}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 2.0000000000000001e-27Initial program 99.3%
add-sqr-sqrt98.9%
sqrt-unprod74.5%
associate-*l/74.6%
*-un-lft-identity74.6%
associate-*l/74.6%
*-un-lft-identity74.6%
frac-times74.6%
Applied egg-rr74.7%
Simplified74.8%
Taylor expanded in k around 0 74.8%
associate-*r*74.8%
*-commutative74.8%
*-commutative74.8%
Simplified74.8%
sqrt-div99.4%
associate-*r*99.4%
sqrt-unprod99.2%
div-inv99.1%
sqrt-unprod99.3%
associate-*r*99.3%
pow1/299.3%
pow-flip99.4%
metadata-eval99.4%
Applied egg-rr99.4%
if 2.0000000000000001e-27 < 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.6%
clear-num99.6%
sqrt-div99.6%
metadata-eval99.6%
Applied egg-rr99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.5%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* n (* 2.0 PI)) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return pow(k, -0.5) * pow((n * (2.0 * ((double) M_PI))), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((n * (2.0 * Math.PI)), ((1.0 - k) / 2.0));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((n * (2.0 * math.pi)), ((1.0 - k) / 2.0))
function code(k, n) return Float64((k ^ -0.5) * (Float64(n * Float64(2.0 * pi)) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((n * (2.0 * pi)) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.5%
expm1-log1p-u96.3%
expm1-udef75.6%
inv-pow75.6%
sqrt-pow275.6%
metadata-eval75.6%
Applied egg-rr75.6%
expm1-def96.3%
expm1-log1p99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* 2.0 n))))
(if (<= k 2e-27)
(* (pow k -0.5) (sqrt t_0))
(sqrt (/ (pow t_0 (- 1.0 k)) k)))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
double tmp;
if (k <= 2e-27) {
tmp = pow(k, -0.5) * sqrt(t_0);
} else {
tmp = sqrt((pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
double tmp;
if (k <= 2e-27) {
tmp = Math.pow(k, -0.5) * Math.sqrt(t_0);
} else {
tmp = Math.sqrt((Math.pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): t_0 = math.pi * (2.0 * n) tmp = 0 if k <= 2e-27: tmp = math.pow(k, -0.5) * math.sqrt(t_0) else: tmp = math.sqrt((math.pow(t_0, (1.0 - k)) / k)) return tmp
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) tmp = 0.0 if (k <= 2e-27) tmp = Float64((k ^ -0.5) * sqrt(t_0)); else tmp = sqrt(Float64((t_0 ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) t_0 = pi * (2.0 * n); tmp = 0.0; if (k <= 2e-27) tmp = (k ^ -0.5) * sqrt(t_0); else tmp = sqrt(((t_0 ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2e-27], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[t$95$0, N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\mathbf{if}\;k \leq 2 \cdot 10^{-27}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t_0}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 2.0000000000000001e-27Initial program 99.3%
add-sqr-sqrt98.9%
sqrt-unprod74.5%
associate-*l/74.6%
*-un-lft-identity74.6%
associate-*l/74.6%
*-un-lft-identity74.6%
frac-times74.6%
Applied egg-rr74.7%
Simplified74.8%
Taylor expanded in k around 0 74.8%
associate-*r*74.8%
*-commutative74.8%
*-commutative74.8%
Simplified74.8%
sqrt-div99.4%
associate-*r*99.4%
sqrt-unprod99.2%
div-inv99.1%
sqrt-unprod99.3%
associate-*r*99.3%
pow1/299.3%
pow-flip99.4%
metadata-eval99.4%
Applied egg-rr99.4%
if 2.0000000000000001e-27 < 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.6%
Final simplification99.5%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (+ 0.5 (* k -0.5))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), (0.5 + (k * -0.5))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), (0.5 + (k * -0.5))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), (0.5 + (k * -0.5))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(0.5 + Float64(k * -0.5))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ (0.5 + (k * -0.5))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(0.5 + N[(k * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 + k \cdot -0.5\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-lft-identity99.5%
*-commutative99.5%
associate-*l*99.5%
div-sub99.5%
sub-neg99.5%
distribute-frac-neg99.5%
metadata-eval99.5%
neg-mul-199.5%
associate-/l*99.5%
associate-/r/99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (if (<= k 6.8e+253) (* (pow k -0.5) (sqrt (* PI (* 2.0 n)))) (pow (pow (/ 2.0 (/ k (* PI n))) 2.0) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 6.8e+253) {
tmp = pow(k, -0.5) * sqrt((((double) M_PI) * (2.0 * n)));
} else {
tmp = pow(pow((2.0 / (k / (((double) M_PI) * n))), 2.0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 6.8e+253) {
tmp = Math.pow(k, -0.5) * Math.sqrt((Math.PI * (2.0 * n)));
} else {
tmp = Math.pow(Math.pow((2.0 / (k / (Math.PI * n))), 2.0), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 6.8e+253: tmp = math.pow(k, -0.5) * math.sqrt((math.pi * (2.0 * n))) else: tmp = math.pow(math.pow((2.0 / (k / (math.pi * n))), 2.0), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 6.8e+253) tmp = Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(2.0 * n)))); else tmp = (Float64(2.0 / Float64(k / Float64(pi * n))) ^ 2.0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 6.8e+253) tmp = (k ^ -0.5) * sqrt((pi * (2.0 * n))); else tmp = ((2.0 / (k / (pi * n))) ^ 2.0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 6.8e+253], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 / N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.8 \cdot 10^{+253}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(2 \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\frac{2}{\frac{k}{\pi \cdot n}}\right)}^{2}\right)}^{0.25}\\
\end{array}
\end{array}
if k < 6.80000000000000035e253Initial program 99.4%
add-sqr-sqrt99.2%
sqrt-unprod86.7%
associate-*l/86.7%
*-un-lft-identity86.7%
associate-*l/86.7%
*-un-lft-identity86.7%
frac-times86.7%
Applied egg-rr86.8%
Simplified86.8%
Taylor expanded in k around 0 44.6%
associate-*r*44.6%
*-commutative44.6%
*-commutative44.6%
Simplified44.6%
sqrt-div57.3%
associate-*r*57.3%
sqrt-unprod57.1%
div-inv57.1%
sqrt-unprod57.2%
associate-*r*57.2%
pow1/257.2%
pow-flip57.3%
metadata-eval57.3%
Applied egg-rr57.3%
if 6.80000000000000035e253 < 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.9%
associate-*r*2.9%
*-commutative2.9%
*-commutative2.9%
Simplified2.9%
associate-*r*2.9%
*-commutative2.9%
*-un-lft-identity2.9%
times-frac2.9%
metadata-eval2.9%
Applied egg-rr2.9%
pow1/22.9%
metadata-eval2.9%
pow-prod-up2.9%
pow-prod-down20.0%
pow220.0%
clear-num20.0%
un-div-inv20.0%
Applied egg-rr20.0%
Final simplification53.2%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (sqrt (* PI (* 2.0 n)))))
double code(double k, double n) {
return pow(k, -0.5) * sqrt((((double) M_PI) * (2.0 * n)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.sqrt((Math.PI * (2.0 * n)));
}
def code(k, n): return math.pow(k, -0.5) * math.sqrt((math.pi * (2.0 * n)))
function code(k, n) return Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(2.0 * n)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * sqrt((pi * (2.0 * n))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(2 \cdot n\right)}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod88.1%
associate-*l/88.2%
*-un-lft-identity88.2%
associate-*l/88.2%
*-un-lft-identity88.2%
frac-times88.2%
Applied egg-rr88.2%
Simplified88.3%
Taylor expanded in k around 0 40.0%
associate-*r*40.0%
*-commutative40.0%
*-commutative40.0%
Simplified40.0%
sqrt-div51.3%
associate-*r*51.3%
sqrt-unprod51.2%
div-inv51.2%
sqrt-unprod51.3%
associate-*r*51.3%
pow1/251.3%
pow-flip51.3%
metadata-eval51.3%
Applied egg-rr51.3%
Final simplification51.3%
(FPCore (k n) :precision binary64 (/ (sqrt (* PI n)) (sqrt (/ k 2.0))))
double code(double k, double n) {
return sqrt((((double) M_PI) * n)) / sqrt((k / 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * n)) / Math.sqrt((k / 2.0));
}
def code(k, n): return math.sqrt((math.pi * n)) / math.sqrt((k / 2.0))
function code(k, n) return Float64(sqrt(Float64(pi * n)) / sqrt(Float64(k / 2.0))) end
function tmp = code(k, n) tmp = sqrt((pi * n)) / sqrt((k / 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\pi \cdot n}}{\sqrt{\frac{k}{2}}}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod88.1%
associate-*l/88.2%
*-un-lft-identity88.2%
associate-*l/88.2%
*-un-lft-identity88.2%
frac-times88.2%
Applied egg-rr88.2%
Simplified88.3%
Taylor expanded in k around 0 40.0%
associate-*r*40.0%
*-commutative40.0%
*-commutative40.0%
Simplified40.0%
sqrt-div51.3%
associate-*r*51.3%
*-commutative51.3%
sqrt-unprod51.2%
associate-/l*51.2%
*-commutative51.2%
sqrt-undiv51.3%
Applied egg-rr51.3%
Final simplification51.3%
(FPCore (k n) :precision binary64 (pow (/ k (* PI (* 2.0 n))) -0.5))
double code(double k, double n) {
return pow((k / (((double) M_PI) * (2.0 * n))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / (Math.PI * (2.0 * n))), -0.5);
}
def code(k, n): return math.pow((k / (math.pi * (2.0 * n))), -0.5)
function code(k, n) return Float64(k / Float64(pi * Float64(2.0 * n))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (pi * (2.0 * n))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{\pi \cdot \left(2 \cdot n\right)}\right)}^{-0.5}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod88.1%
associate-*l/88.2%
*-un-lft-identity88.2%
associate-*l/88.2%
*-un-lft-identity88.2%
frac-times88.2%
Applied egg-rr88.2%
Simplified88.3%
Taylor expanded in k around 0 40.0%
associate-*r*40.0%
*-commutative40.0%
*-commutative40.0%
Simplified40.0%
clear-num40.0%
sqrt-div40.9%
metadata-eval40.9%
*-un-lft-identity40.9%
associate-*r*40.9%
*-commutative40.9%
times-frac40.9%
metadata-eval40.9%
Applied egg-rr40.9%
expm1-log1p-u39.1%
expm1-udef41.6%
inv-pow41.6%
sqrt-pow241.6%
metadata-eval41.6%
Applied egg-rr41.6%
expm1-def39.1%
expm1-log1p41.0%
associate-*r/41.0%
*-commutative41.0%
associate-/l*41.0%
metadata-eval41.0%
associate-/l*41.0%
*-commutative41.0%
/-rgt-identity41.0%
*-commutative41.0%
associate-*l*41.0%
Simplified41.0%
Final simplification41.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(2.0 * Float64(n * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (n * (pi / k)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(n \cdot \frac{\pi}{k}\right)}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod88.1%
associate-*l/88.2%
*-un-lft-identity88.2%
associate-*l/88.2%
*-un-lft-identity88.2%
frac-times88.2%
Applied egg-rr88.2%
Simplified88.3%
Taylor expanded in k around 0 40.0%
associate-*r*40.0%
*-commutative40.0%
*-commutative40.0%
Simplified40.0%
associate-*r*40.0%
*-commutative40.0%
*-un-lft-identity40.0%
times-frac40.0%
metadata-eval40.0%
Applied egg-rr40.0%
associate-/l*40.0%
associate-/r/40.1%
Applied egg-rr40.1%
Final simplification40.1%
(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%
add-sqr-sqrt99.3%
sqrt-unprod88.1%
associate-*l/88.2%
*-un-lft-identity88.2%
associate-*l/88.2%
*-un-lft-identity88.2%
frac-times88.2%
Applied egg-rr88.2%
Simplified88.3%
Taylor expanded in k around 0 40.0%
associate-*r*40.0%
*-commutative40.0%
*-commutative40.0%
Simplified40.0%
Taylor expanded in n around 0 40.0%
associate-*r/40.0%
associate-*r*40.0%
*-commutative40.0%
associate-*l/40.1%
*-commutative40.1%
*-commutative40.1%
Simplified40.1%
Final simplification40.1%
herbie shell --seed 2023318
(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))))