
(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 13 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 (* (pow k -0.5) (pow (fabs (* PI (* n 2.0))) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return pow(k, -0.5) * pow(fabs((((double) M_PI) * (n * 2.0))), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow(Math.abs((Math.PI * (n * 2.0))), ((1.0 - k) / 2.0));
}
def code(k, n): return math.pow(k, -0.5) * math.pow(math.fabs((math.pi * (n * 2.0))), ((1.0 - k) / 2.0))
function code(k, n) return Float64((k ^ -0.5) * (abs(Float64(pi * Float64(n * 2.0))) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * (abs((pi * (n * 2.0))) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[Abs[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(\left|\pi \cdot \left(n \cdot 2\right)\right|\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 98.3%
associate-*r*98.3%
add-sqr-sqrt83.8%
sqrt-unprod81.1%
*-commutative81.1%
*-commutative81.1%
swap-sqr81.1%
pow281.1%
metadata-eval81.1%
Applied egg-rr81.1%
*-commutative81.1%
metadata-eval81.1%
unpow281.1%
swap-sqr81.1%
rem-sqrt-square99.1%
*-commutative99.1%
associate-*l*99.1%
Simplified99.1%
*-un-lft-identity99.1%
inv-pow99.1%
sqrt-pow299.1%
metadata-eval99.1%
Applied egg-rr99.1%
*-lft-identity99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* n 2.0))))
(if (<= k 2.4e-68)
(* (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 <= 2.4e-68) {
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 <= 2.4e-68) {
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 <= 2.4e-68: 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 <= 2.4e-68) 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 <= 2.4e-68) 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, 2.4e-68], 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 2.4 \cdot 10^{-68}:\\
\;\;\;\;{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.39999999999999991e-68Initial program 99.4%
Taylor expanded in k around 0 64.9%
*-commutative64.9%
associate-/l*65.0%
Simplified65.0%
pow165.0%
sqrt-unprod64.9%
associate-*r*64.9%
*-commutative64.9%
Applied egg-rr64.9%
unpow164.9%
associate-*r/64.8%
*-commutative64.8%
associate-/l*64.9%
*-commutative64.9%
Simplified64.9%
associate-*r/64.8%
*-commutative64.8%
div-inv64.9%
sqrt-unprod99.5%
inv-pow99.5%
sqrt-pow199.5%
metadata-eval99.5%
*-commutative99.5%
Applied egg-rr99.5%
if 2.39999999999999991e-68 < k Initial program 97.9%
add-sqr-sqrt97.3%
sqrt-unprod97.4%
*-commutative97.4%
associate-*r*97.4%
div-sub97.4%
metadata-eval97.4%
div-inv97.4%
*-commutative97.4%
Applied egg-rr97.4%
Simplified97.4%
Final simplification97.9%
(FPCore (k n) :precision binary64 (if (<= k 9.6e+94) (* (pow k -0.5) (sqrt (* PI (* n 2.0)))) (sqrt (+ 1.0 (fma n (* PI (/ 2.0 k)) -1.0)))))
double code(double k, double n) {
double tmp;
if (k <= 9.6e+94) {
tmp = pow(k, -0.5) * sqrt((((double) M_PI) * (n * 2.0)));
} else {
tmp = sqrt((1.0 + fma(n, (((double) M_PI) * (2.0 / k)), -1.0)));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 9.6e+94) tmp = Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(n * 2.0)))); else tmp = sqrt(Float64(1.0 + fma(n, Float64(pi * Float64(2.0 / k)), -1.0))); end return tmp end
code[k_, n_] := If[LessEqual[k, 9.6e+94], N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(1.0 + N[(n * N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 9.6 \cdot 10^{+94}:\\
\;\;\;\;{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(n \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + \mathsf{fma}\left(n, \pi \cdot \frac{2}{k}, -1\right)}\\
\end{array}
\end{array}
if k < 9.5999999999999993e94Initial program 96.7%
Taylor expanded in k around 0 49.4%
*-commutative49.4%
associate-/l*49.4%
Simplified49.4%
pow149.4%
sqrt-unprod49.4%
associate-*r*49.4%
*-commutative49.4%
Applied egg-rr49.4%
unpow149.4%
associate-*r/49.4%
*-commutative49.4%
associate-/l*49.4%
*-commutative49.4%
Simplified49.4%
associate-*r/49.4%
*-commutative49.4%
div-inv49.4%
sqrt-unprod66.6%
inv-pow66.6%
sqrt-pow166.6%
metadata-eval66.6%
*-commutative66.6%
Applied egg-rr66.6%
if 9.5999999999999993e94 < k Initial program 100.0%
associate-*r*100.0%
add-sqr-sqrt78.4%
sqrt-unprod100.0%
*-commutative100.0%
*-commutative100.0%
swap-sqr100.0%
pow2100.0%
metadata-eval100.0%
Applied egg-rr100.0%
*-commutative100.0%
metadata-eval100.0%
unpow2100.0%
swap-sqr100.0%
rem-sqrt-square100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
*-un-lft-identity100.0%
inv-pow100.0%
sqrt-pow2100.0%
metadata-eval100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in k around 0 2.8%
fabs-mul2.8%
metadata-eval2.8%
Simplified2.8%
expm1-log1p-u2.8%
expm1-undefine33.4%
add-sqr-sqrt33.4%
add-sqr-sqrt33.4%
associate-/l*33.4%
add-sqr-sqrt18.8%
fabs-sqr18.8%
add-sqr-sqrt33.2%
associate-/l*33.2%
Applied egg-rr33.2%
log1p-undefine33.2%
rem-exp-log33.2%
associate-+r-33.2%
*-commutative33.2%
associate-*l*33.2%
*-commutative33.2%
associate-*r/33.2%
*-commutative33.2%
associate-*r/33.2%
fma-neg33.2%
metadata-eval33.2%
Simplified33.2%
Final simplification50.3%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (- 0.5 (* k 0.5)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), (0.5 - (k * 0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), (0.5 - (k * 0.5)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), (0.5 - (k * 0.5)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 - Float64(k * 0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ (0.5 - (k * 0.5))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}
\end{array}
Initial program 98.3%
associate-*l/98.3%
*-lft-identity98.3%
associate-*l*98.3%
div-sub98.3%
metadata-eval98.3%
Simplified98.3%
div-inv98.3%
div-inv98.3%
metadata-eval98.3%
inv-pow98.3%
sqrt-pow298.3%
metadata-eval98.3%
Applied egg-rr98.3%
Final simplification98.3%
(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 98.3%
associate-*l/98.3%
*-lft-identity98.3%
associate-*l*98.3%
div-sub98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (sqrt (* PI (* n 2.0)))))
double code(double k, double n) {
return pow(k, -0.5) * sqrt((((double) M_PI) * (n * 2.0)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.sqrt((Math.PI * (n * 2.0)));
}
def code(k, n): return math.pow(k, -0.5) * math.sqrt((math.pi * (n * 2.0)))
function code(k, n) return Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(n * 2.0)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * sqrt((pi * (n * 2.0))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(n \cdot 2\right)}
\end{array}
Initial program 98.3%
Taylor expanded in k around 0 26.3%
*-commutative26.3%
associate-/l*26.3%
Simplified26.3%
pow126.3%
sqrt-unprod26.3%
associate-*r*26.3%
*-commutative26.3%
Applied egg-rr26.3%
unpow126.3%
associate-*r/26.3%
*-commutative26.3%
associate-/l*26.3%
*-commutative26.3%
Simplified26.3%
associate-*r/26.3%
*-commutative26.3%
div-inv26.3%
sqrt-unprod35.1%
inv-pow35.1%
sqrt-pow135.1%
metadata-eval35.1%
*-commutative35.1%
Applied egg-rr35.1%
Final simplification35.1%
(FPCore (k n) :precision binary64 (* (sqrt (* PI n)) (sqrt (/ 2.0 k))))
double code(double k, double n) {
return sqrt((((double) M_PI) * n)) * sqrt((2.0 / k));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI * n)) * Math.sqrt((2.0 / k));
}
def code(k, n): return math.sqrt((math.pi * n)) * math.sqrt((2.0 / k))
function code(k, n) return Float64(sqrt(Float64(pi * n)) * sqrt(Float64(2.0 / k))) end
function tmp = code(k, n) tmp = sqrt((pi * n)) * sqrt((2.0 / k)); end
code[k_, n_] := N[(N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot n} \cdot \sqrt{\frac{2}{k}}
\end{array}
Initial program 98.3%
Taylor expanded in k around 0 26.3%
*-commutative26.3%
associate-/l*26.3%
Simplified26.3%
pow126.3%
sqrt-unprod26.3%
associate-*r*26.3%
*-commutative26.3%
Applied egg-rr26.3%
unpow126.3%
associate-*r/26.3%
*-commutative26.3%
associate-/l*26.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in n around 0 26.3%
div-inv26.3%
associate-*r*26.3%
*-commutative26.3%
associate-*r*26.3%
div-inv26.3%
sqrt-prod35.1%
*-commutative35.1%
Applied egg-rr35.1%
Final simplification35.1%
(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 98.3%
Taylor expanded in k around 0 35.0%
associate-*l/35.0%
*-un-lft-identity35.0%
sqrt-unprod35.1%
*-commutative35.1%
associate-*r*35.1%
Applied egg-rr35.1%
Final simplification35.1%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (* k (/ 0.5 (* PI n))))))
double code(double k, double n) {
return 1.0 / sqrt((k * (0.5 / (((double) M_PI) * n))));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt((k * (0.5 / (Math.PI * n))));
}
def code(k, n): return 1.0 / math.sqrt((k * (0.5 / (math.pi * n))))
function code(k, n) return Float64(1.0 / sqrt(Float64(k * Float64(0.5 / Float64(pi * n))))) end
function tmp = code(k, n) tmp = 1.0 / sqrt((k * (0.5 / (pi * n)))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(k * N[(0.5 / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{k \cdot \frac{0.5}{\pi \cdot n}}}
\end{array}
Initial program 98.3%
Taylor expanded in k around 0 26.3%
*-commutative26.3%
associate-/l*26.3%
Simplified26.3%
pow126.3%
sqrt-unprod26.3%
associate-*r*26.3%
*-commutative26.3%
Applied egg-rr26.3%
unpow126.3%
associate-*r/26.3%
*-commutative26.3%
associate-/l*26.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in n around 0 26.3%
sqrt-prod26.3%
add-sqr-sqrt26.2%
fabs-sqr26.2%
add-sqr-sqrt26.8%
sqrt-prod26.8%
associate-/l*26.8%
clear-num26.7%
sqrt-div27.3%
metadata-eval27.3%
*-un-lft-identity27.3%
add-sqr-sqrt26.8%
fabs-sqr26.8%
add-sqr-sqrt26.8%
times-frac26.8%
metadata-eval26.8%
*-commutative26.8%
Applied egg-rr26.8%
associate-*r/26.8%
*-commutative26.8%
associate-/l*26.8%
*-commutative26.8%
Simplified26.8%
Final simplification26.8%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ k (* PI (* n 2.0))))))
double code(double k, double n) {
return 1.0 / sqrt((k / (((double) M_PI) * (n * 2.0))));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt((k / (Math.PI * (n * 2.0))));
}
def code(k, n): return 1.0 / math.sqrt((k / (math.pi * (n * 2.0))))
function code(k, n) return Float64(1.0 / sqrt(Float64(k / Float64(pi * Float64(n * 2.0))))) end
function tmp = code(k, n) tmp = 1.0 / sqrt((k / (pi * (n * 2.0)))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(k / N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{k}{\pi \cdot \left(n \cdot 2\right)}}}
\end{array}
Initial program 98.3%
Taylor expanded in k around 0 26.3%
*-commutative26.3%
associate-/l*26.3%
Simplified26.3%
pow126.3%
sqrt-unprod26.3%
associate-*r*26.3%
*-commutative26.3%
Applied egg-rr26.3%
unpow126.3%
associate-*r/26.3%
*-commutative26.3%
associate-/l*26.3%
*-commutative26.3%
Simplified26.3%
associate-*r/26.3%
*-commutative26.3%
sqrt-undiv35.1%
clear-num35.1%
sqrt-undiv26.8%
Applied egg-rr26.8%
Final simplification26.8%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ (* PI n) k))))
double code(double k, double n) {
return sqrt((2.0 * ((((double) M_PI) * n) / k)));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * ((Math.PI * n) / k)));
}
def code(k, n): return math.sqrt((2.0 * ((math.pi * n) / k)))
function code(k, n) return sqrt(Float64(2.0 * Float64(Float64(pi * n) / k))) end
function tmp = code(k, n) tmp = sqrt((2.0 * ((pi * n) / k))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(N[(Pi * n), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi \cdot n}{k}}
\end{array}
Initial program 98.3%
Taylor expanded in k around 0 26.3%
*-commutative26.3%
associate-/l*26.3%
Simplified26.3%
pow126.3%
sqrt-unprod26.3%
associate-*r*26.3%
*-commutative26.3%
Applied egg-rr26.3%
unpow126.3%
associate-*r/26.3%
*-commutative26.3%
associate-/l*26.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in n around 0 26.3%
Final simplification26.3%
(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 98.3%
Taylor expanded in k around 0 26.3%
*-commutative26.3%
associate-/l*26.3%
Simplified26.3%
pow126.3%
sqrt-unprod26.3%
associate-*r*26.3%
*-commutative26.3%
Applied egg-rr26.3%
unpow126.3%
associate-*r/26.3%
*-commutative26.3%
associate-/l*26.3%
*-commutative26.3%
Simplified26.3%
Final simplification26.3%
(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 98.3%
Taylor expanded in k around 0 26.3%
*-commutative26.3%
associate-/l*26.3%
Simplified26.3%
sqrt-unprod26.3%
associate-*r*26.3%
*-commutative26.3%
Applied egg-rr26.3%
Final simplification26.3%
herbie shell --seed 2024060
(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))))