
(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 (* PI (* n 2.0)))) (* (/ 1.0 (sqrt k)) (/ (sqrt t_0) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (n * 2.0);
return (1.0 / sqrt(k)) * (sqrt(t_0) / pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (n * 2.0);
return (1.0 / Math.sqrt(k)) * (Math.sqrt(t_0) / Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = math.pi * (n * 2.0) return (1.0 / math.sqrt(k)) * (math.sqrt(t_0) / math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(pi * Float64(n * 2.0)) return Float64(Float64(1.0 / sqrt(k)) * Float64(sqrt(t_0) / (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = pi * (n * 2.0); tmp = (1.0 / sqrt(k)) * (sqrt(t_0) / (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[t$95$0], $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(n \cdot 2\right)\\
\frac{1}{\sqrt{k}} \cdot \frac{\sqrt{t_0}}{{t_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.1%
div-sub99.1%
metadata-eval99.1%
pow-sub99.3%
pow1/299.3%
associate-*l*99.3%
associate-*l*99.3%
div-inv99.3%
metadata-eval99.3%
Applied egg-rr99.3%
*-commutative99.3%
associate-*r*99.3%
*-commutative99.3%
*-commutative99.3%
associate-*r*99.3%
*-commutative99.3%
*-commutative99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (k n) :precision binary64 (if (<= k 1.35e-75) (* (pow k -0.5) (sqrt (* PI (* n 2.0)))) (pow (/ k (pow (* PI (+ n n)) (- 1.0 k))) -0.5)))
double code(double k, double n) {
double tmp;
if (k <= 1.35e-75) {
tmp = pow(k, -0.5) * sqrt((((double) M_PI) * (n * 2.0)));
} else {
tmp = pow((k / pow((((double) M_PI) * (n + n)), (1.0 - k))), -0.5);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.35e-75) {
tmp = Math.pow(k, -0.5) * Math.sqrt((Math.PI * (n * 2.0)));
} else {
tmp = Math.pow((k / Math.pow((Math.PI * (n + n)), (1.0 - k))), -0.5);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.35e-75: tmp = math.pow(k, -0.5) * math.sqrt((math.pi * (n * 2.0))) else: tmp = math.pow((k / math.pow((math.pi * (n + n)), (1.0 - k))), -0.5) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.35e-75) tmp = Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(n * 2.0)))); else tmp = Float64(k / (Float64(pi * Float64(n + n)) ^ Float64(1.0 - k))) ^ -0.5; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.35e-75) tmp = (k ^ -0.5) * sqrt((pi * (n * 2.0))); else tmp = (k / ((pi * (n + n)) ^ (1.0 - k))) ^ -0.5; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.35e-75], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(k / N[Power[N[(Pi * N[(n + n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.35 \cdot 10^{-75}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(n \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{k}{{\left(\pi \cdot \left(n + n\right)\right)}^{\left(1 - k\right)}}\right)}^{-0.5}\\
\end{array}
\end{array}
if k < 1.3499999999999999e-75Initial program 98.2%
*-commutative98.2%
*-commutative98.2%
associate-*r*98.2%
div-inv98.2%
expm1-log1p-u92.0%
expm1-udef77.4%
Applied egg-rr49.1%
expm1-def63.8%
expm1-log1p67.0%
*-commutative67.0%
associate-*r*67.0%
*-commutative67.0%
Simplified67.0%
Taylor expanded in k around 0 67.0%
div-inv67.0%
sqrt-prod98.3%
*-commutative98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
inv-pow98.3%
metadata-eval98.3%
pow-prod-up98.3%
sqrt-unprod97.8%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
if 1.3499999999999999e-75 < k Initial program 99.6%
expm1-log1p-u98.8%
expm1-udef65.8%
pow1/265.8%
pow-flip65.8%
metadata-eval65.8%
Applied egg-rr65.8%
expm1-def98.8%
expm1-log1p99.6%
Simplified99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
sqrt-pow199.6%
*-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
add-sqr-sqrt99.5%
sqrt-unprod99.6%
pow-prod-up99.5%
metadata-eval99.5%
inv-pow99.5%
sqrt-prod99.6%
div-inv99.6%
clear-num99.6%
sqrt-div99.6%
Applied egg-rr99.6%
expm1-log1p-u98.8%
expm1-udef90.7%
pow1/290.7%
pow-flip90.7%
metadata-eval90.7%
Applied egg-rr90.7%
Simplified99.6%
Final simplification99.2%
(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.1%
expm1-log1p-u96.1%
expm1-udef74.3%
pow1/274.3%
pow-flip74.3%
metadata-eval74.3%
Applied egg-rr74.3%
expm1-def96.1%
expm1-log1p99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* n 2.0))))
(if (<= k 1.35e-75)
(* (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) * (n * 2.0);
double tmp;
if (k <= 1.35e-75) {
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 * (n * 2.0);
double tmp;
if (k <= 1.35e-75) {
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 * (n * 2.0) tmp = 0 if k <= 1.35e-75: 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(n * 2.0)) tmp = 0.0 if (k <= 1.35e-75) 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 * (n * 2.0); tmp = 0.0; if (k <= 1.35e-75) 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[(n * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.35e-75], 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(n \cdot 2\right)\\
\mathbf{if}\;k \leq 1.35 \cdot 10^{-75}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t_0}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 1.3499999999999999e-75Initial program 98.2%
*-commutative98.2%
*-commutative98.2%
associate-*r*98.2%
div-inv98.2%
expm1-log1p-u92.0%
expm1-udef77.4%
Applied egg-rr49.1%
expm1-def63.8%
expm1-log1p67.0%
*-commutative67.0%
associate-*r*67.0%
*-commutative67.0%
Simplified67.0%
Taylor expanded in k around 0 67.0%
div-inv67.0%
sqrt-prod98.3%
*-commutative98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
inv-pow98.3%
metadata-eval98.3%
pow-prod-up98.3%
sqrt-unprod97.8%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
if 1.3499999999999999e-75 < k Initial program 99.6%
*-commutative99.6%
*-commutative99.6%
associate-*r*99.6%
div-inv99.6%
expm1-log1p-u98.8%
expm1-udef90.7%
Applied egg-rr90.7%
expm1-def98.8%
expm1-log1p99.6%
*-commutative99.6%
associate-*r*99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.2%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* n 2.0)) (/ (- 1.0 k) 2.0)) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (n * 2.0)), ((1.0 - k) / 2.0)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (n * 2.0)), ((1.0 - k) / 2.0)) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (n * 2.0)), ((1.0 - k) / 2.0)) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(n * 2.0)) ^ Float64(Float64(1.0 - k) / 2.0)) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (n * 2.0)) ^ ((1.0 - k) / 2.0)) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.1%
associate-*l/99.1%
*-lft-identity99.1%
*-commutative99.1%
associate-*l*99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (k n) :precision binary64 (if (<= k 3e+228) (/ (sqrt (* PI (* n 2.0))) (sqrt k)) (cbrt (pow (* 2.0 (/ PI (/ k n))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 3e+228) {
tmp = sqrt((((double) M_PI) * (n * 2.0))) / sqrt(k);
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) / (k / n))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3e+228) {
tmp = Math.sqrt((Math.PI * (n * 2.0))) / Math.sqrt(k);
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI / (k / n))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 3e+228) tmp = Float64(sqrt(Float64(pi * Float64(n * 2.0))) / sqrt(k)); else tmp = cbrt((Float64(2.0 * Float64(pi / Float64(k / n))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 3e+228], N[(N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi / N[(k / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{+228}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(n \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \frac{\pi}{\frac{k}{n}}\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 3.0000000000000001e228Initial program 99.0%
*-commutative99.0%
*-commutative99.0%
associate-*r*99.0%
div-inv99.0%
expm1-log1p-u96.0%
expm1-udef84.2%
Applied egg-rr73.3%
expm1-def85.1%
expm1-log1p87.0%
*-commutative87.0%
associate-*r*87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in k around 0 41.4%
sqrt-div53.4%
*-commutative53.4%
*-commutative53.4%
associate-*r*53.4%
*-commutative53.4%
Applied egg-rr53.4%
if 3.0000000000000001e228 < k Initial program 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
div-inv100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 2.8%
*-un-lft-identity2.8%
times-frac2.8%
metadata-eval2.8%
*-commutative2.8%
Applied egg-rr2.8%
add-cbrt-cube23.0%
add-sqr-sqrt23.0%
pow123.0%
pow1/223.0%
pow-prod-up23.0%
associate-/l*23.0%
metadata-eval23.0%
Applied egg-rr23.0%
Final simplification49.5%
(FPCore (k n) :precision binary64 (if (<= k 8.2e+229) (* (pow k -0.5) (sqrt (* PI (* n 2.0)))) (cbrt (pow (* 2.0 (/ PI (/ k n))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 8.2e+229) {
tmp = pow(k, -0.5) * sqrt((((double) M_PI) * (n * 2.0)));
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) / (k / n))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 8.2e+229) {
tmp = Math.pow(k, -0.5) * Math.sqrt((Math.PI * (n * 2.0)));
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI / (k / n))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 8.2e+229) tmp = Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(n * 2.0)))); else tmp = cbrt((Float64(2.0 * Float64(pi / Float64(k / n))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 8.2e+229], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi / N[(k / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 8.2 \cdot 10^{+229}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(n \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \frac{\pi}{\frac{k}{n}}\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 8.2000000000000003e229Initial program 99.0%
*-commutative99.0%
*-commutative99.0%
associate-*r*99.0%
div-inv99.0%
expm1-log1p-u96.0%
expm1-udef84.2%
Applied egg-rr73.3%
expm1-def85.1%
expm1-log1p87.0%
*-commutative87.0%
associate-*r*87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in k around 0 41.4%
div-inv41.3%
sqrt-prod53.4%
*-commutative53.4%
*-commutative53.4%
associate-*r*53.4%
*-commutative53.4%
inv-pow53.4%
metadata-eval53.4%
pow-prod-up53.5%
sqrt-unprod53.2%
add-sqr-sqrt53.5%
Applied egg-rr53.5%
if 8.2000000000000003e229 < k Initial program 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
div-inv100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 2.8%
*-un-lft-identity2.8%
times-frac2.8%
metadata-eval2.8%
*-commutative2.8%
Applied egg-rr2.8%
add-cbrt-cube23.0%
add-sqr-sqrt23.0%
pow123.0%
pow1/223.0%
pow-prod-up23.0%
associate-/l*23.0%
metadata-eval23.0%
Applied egg-rr23.0%
Final simplification49.5%
(FPCore (k n) :precision binary64 (/ (sqrt (* PI (* n 2.0))) (sqrt k)))
double code(double k, double n) {
return sqrt((((double) M_PI) * (n * 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * (n * 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((math.pi * (n * 2.0))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(pi * Float64(n * 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((pi * (n * 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\pi \cdot \left(n \cdot 2\right)}}{\sqrt{k}}
\end{array}
Initial program 99.1%
*-commutative99.1%
*-commutative99.1%
associate-*r*99.1%
div-inv99.1%
expm1-log1p-u96.5%
expm1-udef86.2%
Applied egg-rr76.7%
expm1-def87.1%
expm1-log1p88.7%
*-commutative88.7%
associate-*r*88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in k around 0 36.4%
sqrt-div46.9%
*-commutative46.9%
*-commutative46.9%
associate-*r*46.9%
*-commutative46.9%
Applied egg-rr46.9%
Final simplification46.9%
(FPCore (k n) :precision binary64 (pow (* (/ k n) (/ 0.5 PI)) -0.5))
double code(double k, double n) {
return pow(((k / n) * (0.5 / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k / n) * (0.5 / Math.PI)), -0.5);
}
def code(k, n): return math.pow(((k / n) * (0.5 / math.pi)), -0.5)
function code(k, n) return Float64(Float64(k / n) * Float64(0.5 / pi)) ^ -0.5 end
function tmp = code(k, n) tmp = ((k / n) * (0.5 / pi)) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k / n), $MachinePrecision] * N[(0.5 / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{n} \cdot \frac{0.5}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.1%
*-commutative99.1%
*-commutative99.1%
associate-*r*99.1%
div-inv99.1%
expm1-log1p-u96.5%
expm1-udef86.2%
Applied egg-rr76.7%
expm1-def87.1%
expm1-log1p88.7%
*-commutative88.7%
associate-*r*88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in k around 0 36.4%
clear-num36.4%
sqrt-div37.0%
metadata-eval37.0%
*-commutative37.0%
*-commutative37.0%
associate-*r*37.0%
*-commutative37.0%
Applied egg-rr37.0%
associate-/r*37.0%
*-commutative37.0%
associate-/r*37.0%
associate-/r*37.0%
Simplified37.0%
expm1-log1p-u35.4%
expm1-udef36.6%
pow1/236.6%
pow-flip36.6%
div-inv36.6%
metadata-eval36.6%
metadata-eval36.6%
Applied egg-rr36.6%
expm1-def35.4%
expm1-log1p37.1%
associate-*l/37.1%
*-commutative37.1%
times-frac37.0%
Simplified37.0%
Final simplification37.0%
(FPCore (k n) :precision binary64 (pow (* 0.5 (/ k (* n PI))) -0.5))
double code(double k, double n) {
return pow((0.5 * (k / (n * ((double) M_PI)))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((0.5 * (k / (n * Math.PI))), -0.5);
}
def code(k, n): return math.pow((0.5 * (k / (n * math.pi))), -0.5)
function code(k, n) return Float64(0.5 * Float64(k / Float64(n * pi))) ^ -0.5 end
function tmp = code(k, n) tmp = (0.5 * (k / (n * pi))) ^ -0.5; end
code[k_, n_] := N[Power[N[(0.5 * N[(k / N[(n * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(0.5 \cdot \frac{k}{n \cdot \pi}\right)}^{-0.5}
\end{array}
Initial program 99.1%
*-commutative99.1%
*-commutative99.1%
associate-*r*99.1%
div-inv99.1%
expm1-log1p-u96.5%
expm1-udef86.2%
Applied egg-rr76.7%
expm1-def87.1%
expm1-log1p88.7%
*-commutative88.7%
associate-*r*88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in k around 0 36.4%
clear-num36.4%
sqrt-div37.0%
metadata-eval37.0%
*-commutative37.0%
*-commutative37.0%
associate-*r*37.0%
*-commutative37.0%
Applied egg-rr37.0%
associate-/r*37.0%
*-commutative37.0%
associate-/r*37.0%
associate-/r*37.0%
Simplified37.0%
pow1/237.0%
pow-flip37.1%
div-inv37.1%
metadata-eval37.1%
metadata-eval37.1%
Applied egg-rr37.1%
Final simplification37.1%
(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(Float64(n * 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), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{n \cdot \pi}{k}}
\end{array}
Initial program 99.1%
*-commutative99.1%
*-commutative99.1%
associate-*r*99.1%
div-inv99.1%
expm1-log1p-u96.5%
expm1-udef86.2%
Applied egg-rr76.7%
expm1-def87.1%
expm1-log1p88.7%
*-commutative88.7%
associate-*r*88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in k around 0 36.4%
*-un-lft-identity36.4%
times-frac36.4%
metadata-eval36.4%
*-commutative36.4%
Applied egg-rr36.4%
Final simplification36.4%
herbie shell --seed 2023181
(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))))