
(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 (* n (* 2.0 PI)))) (if (<= k 1e-24) (/ (sqrt t_0) (sqrt k)) (sqrt (/ (pow t_0 (- 1.0 k)) k)))))
double code(double k, double n) {
double t_0 = n * (2.0 * ((double) M_PI));
double tmp;
if (k <= 1e-24) {
tmp = sqrt(t_0) / sqrt(k);
} else {
tmp = sqrt((pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = n * (2.0 * Math.PI);
double tmp;
if (k <= 1e-24) {
tmp = Math.sqrt(t_0) / Math.sqrt(k);
} else {
tmp = Math.sqrt((Math.pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): t_0 = n * (2.0 * math.pi) tmp = 0 if k <= 1e-24: tmp = math.sqrt(t_0) / math.sqrt(k) else: tmp = math.sqrt((math.pow(t_0, (1.0 - k)) / k)) return tmp
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) tmp = 0.0 if (k <= 1e-24) tmp = Float64(sqrt(t_0) / sqrt(k)); else tmp = sqrt(Float64((t_0 ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) t_0 = n * (2.0 * pi); tmp = 0.0; if (k <= 1e-24) tmp = sqrt(t_0) / sqrt(k); else tmp = sqrt(((t_0 ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1e-24], 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] / k), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \pi\right)\\
\mathbf{if}\;k \leq 10^{-24}:\\
\;\;\;\;\frac{\sqrt{t_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t_0}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 9.99999999999999924e-25Initial program 99.2%
associate-*l/99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in k around 0 99.3%
sqrt-unprod99.4%
associate-*r*99.4%
Applied egg-rr99.4%
if 9.99999999999999924e-25 < k Initial program 99.7%
associate-/r/99.7%
associate-*l*99.7%
div-sub99.7%
metadata-eval99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
clear-num99.7%
add-sqr-sqrt99.7%
add-sqr-sqrt99.7%
expm1-log1p99.4%
metadata-eval99.4%
metadata-eval99.4%
div-inv99.4%
div-sub99.4%
add-sqr-sqrt99.4%
sqrt-unprod99.4%
Applied egg-rr99.7%
*-commutative99.7%
distribute-lft-in99.7%
metadata-eval99.7%
*-commutative99.7%
associate-*r*99.7%
metadata-eval99.7%
mul-1-neg99.7%
sub-neg99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow k -0.5) (pow (* n (* 2.0 PI)) (+ -0.5 (* k 0.5)))))
double code(double k, double n) {
return pow(k, -0.5) / pow((n * (2.0 * ((double) M_PI))), (-0.5 + (k * 0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) / Math.pow((n * (2.0 * Math.PI)), (-0.5 + (k * 0.5)));
}
def code(k, n): return math.pow(k, -0.5) / math.pow((n * (2.0 * math.pi)), (-0.5 + (k * 0.5)))
function code(k, n) return Float64((k ^ -0.5) / (Float64(n * Float64(2.0 * pi)) ^ Float64(-0.5 + Float64(k * 0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) / ((n * (2.0 * pi)) ^ (-0.5 + (k * 0.5))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] / N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(-0.5 + N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{k}^{-0.5}}{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-0.5 + k \cdot 0.5\right)}}
\end{array}
Initial program 99.5%
associate-/r/99.6%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
metadata-eval99.5%
Applied egg-rr99.5%
inv-pow99.5%
div-inv99.5%
metadata-eval99.5%
unpow-prod-down99.5%
pow-flip99.5%
pow199.5%
pow1/299.5%
pow-flip99.5%
metadata-eval99.5%
pow-flip99.5%
associate-*r*99.5%
*-commutative99.5%
*-commutative99.5%
sub-neg99.5%
distribute-rgt-neg-in99.5%
metadata-eval99.5%
metadata-eval99.5%
Applied egg-rr99.5%
unpow-199.5%
associate-*r/99.6%
*-rgt-identity99.6%
*-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* n (* 2.0 PI)) (/ (- 1.0 k) 2.0)) (sqrt k)))
double code(double k, double n) {
return pow((n * (2.0 * ((double) M_PI))), ((1.0 - k) / 2.0)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((n * (2.0 * Math.PI)), ((1.0 - k) / 2.0)) / Math.sqrt(k);
}
def code(k, n): return math.pow((n * (2.0 * math.pi)), ((1.0 - k) / 2.0)) / math.sqrt(k)
function code(k, n) return Float64((Float64(n * Float64(2.0 * pi)) ^ Float64(Float64(1.0 - k) / 2.0)) / sqrt(k)) end
function tmp = code(k, n) tmp = ((n * (2.0 * pi)) ^ ((1.0 - k) / 2.0)) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 1.42e+131) (/ (sqrt (* n (* 2.0 PI))) (sqrt k)) (pow (pow (* n (* PI (/ 2.0 k))) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 1.42e+131) {
tmp = sqrt((n * (2.0 * ((double) M_PI)))) / sqrt(k);
} else {
tmp = pow(pow((n * (((double) M_PI) * (2.0 / k))), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.42e+131) {
tmp = Math.sqrt((n * (2.0 * Math.PI))) / Math.sqrt(k);
} else {
tmp = Math.pow(Math.pow((n * (Math.PI * (2.0 / k))), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.42e+131: tmp = math.sqrt((n * (2.0 * math.pi))) / math.sqrt(k) else: tmp = math.pow(math.pow((n * (math.pi * (2.0 / k))), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.42e+131) tmp = Float64(sqrt(Float64(n * Float64(2.0 * pi))) / sqrt(k)); else tmp = (Float64(n * Float64(pi * Float64(2.0 / k))) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.42e+131) tmp = sqrt((n * (2.0 * pi))) / sqrt(k); else tmp = ((n * (pi * (2.0 / k))) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.42e+131], N[(N[Sqrt[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(n * N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.42 \cdot 10^{+131}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(n \cdot \left(\pi \cdot \frac{2}{k}\right)\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 1.42e131Initial program 99.3%
associate-*l/99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in k around 0 68.3%
sqrt-unprod68.4%
associate-*r*68.4%
Applied egg-rr68.4%
if 1.42e131 < k Initial program 100.0%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in k around 0 2.7%
expm1-log1p-u2.7%
expm1-udef26.1%
Applied egg-rr26.1%
expm1-def2.6%
expm1-log1p2.6%
associate-/l*2.6%
*-commutative2.6%
associate-/r*2.6%
Simplified2.6%
Taylor expanded in n around 0 2.6%
*-commutative2.6%
*-rgt-identity2.6%
associate-*r/2.6%
associate-*r/2.6%
associate-*r/2.6%
*-rgt-identity2.6%
Simplified2.6%
pow1/22.6%
associate-*r*2.6%
associate-*r/2.6%
*-commutative2.6%
associate-*r/2.6%
*-commutative2.6%
associate-*r/2.6%
metadata-eval2.6%
pow-pow5.2%
sqr-pow5.2%
pow-prod-down13.5%
Applied egg-rr13.5%
associate-*r*13.5%
associate-*r/13.5%
associate-*l/13.5%
*-commutative13.5%
associate-*l/13.5%
associate-*r*13.5%
*-commutative13.5%
*-commutative13.5%
Simplified13.5%
Final simplification53.6%
(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%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
div-inv38.2%
sqrt-prod49.9%
div-inv49.9%
metadata-eval49.9%
clear-num49.9%
div-inv49.9%
metadata-eval49.9%
div-inv49.9%
clear-num49.9%
Applied egg-rr49.9%
Final simplification49.9%
(FPCore (k n) :precision binary64 (* (sqrt (* n PI)) (sqrt (/ 2.0 k))))
double code(double k, double n) {
return sqrt((n * ((double) M_PI))) * sqrt((2.0 / k));
}
public static double code(double k, double n) {
return Math.sqrt((n * Math.PI)) * Math.sqrt((2.0 / k));
}
def code(k, n): return math.sqrt((n * math.pi)) * math.sqrt((2.0 / k))
function code(k, n) return Float64(sqrt(Float64(n * pi)) * sqrt(Float64(2.0 / k))) end
function tmp = code(k, n) tmp = sqrt((n * pi)) * sqrt((2.0 / k)); end
code[k_, n_] := N[(N[Sqrt[N[(n * Pi), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \pi} \cdot \sqrt{\frac{2}{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
Taylor expanded in n around 0 38.6%
*-commutative38.6%
*-rgt-identity38.6%
associate-*r/38.6%
associate-*r/38.6%
associate-*r/38.6%
*-rgt-identity38.6%
Simplified38.6%
associate-*r/38.6%
associate-*r/38.6%
*-commutative38.6%
associate-*r/38.6%
sqrt-prod50.6%
Applied egg-rr50.6%
Final simplification50.6%
(FPCore (k n) :precision binary64 (/ (sqrt n) (sqrt (/ k (* 2.0 PI)))))
double code(double k, double n) {
return sqrt(n) / sqrt((k / (2.0 * ((double) M_PI))));
}
public static double code(double k, double n) {
return Math.sqrt(n) / Math.sqrt((k / (2.0 * Math.PI)));
}
def code(k, n): return math.sqrt(n) / math.sqrt((k / (2.0 * math.pi)))
function code(k, n) return Float64(sqrt(n) / sqrt(Float64(k / Float64(2.0 * pi)))) end
function tmp = code(k, n) tmp = sqrt(n) / sqrt((k / (2.0 * pi))); end
code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] / N[Sqrt[N[(k / N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{n}}{\sqrt{\frac{k}{2 \cdot \pi}}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
sqrt-div50.6%
associate-/r*50.6%
Applied egg-rr50.6%
Final simplification50.6%
(FPCore (k n) :precision binary64 (/ (sqrt (* n PI)) (sqrt (* k 0.5))))
double code(double k, double n) {
return sqrt((n * ((double) M_PI))) / sqrt((k * 0.5));
}
public static double code(double k, double n) {
return Math.sqrt((n * Math.PI)) / Math.sqrt((k * 0.5));
}
def code(k, n): return math.sqrt((n * math.pi)) / math.sqrt((k * 0.5))
function code(k, n) return Float64(sqrt(Float64(n * pi)) / sqrt(Float64(k * 0.5))) end
function tmp = code(k, n) tmp = sqrt((n * pi)) / sqrt((k * 0.5)); end
code[k_, n_] := N[(N[Sqrt[N[(n * Pi), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \pi}}{\sqrt{k \cdot 0.5}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
associate-/l*50.6%
div-inv50.5%
*-commutative50.5%
sqrt-undiv50.6%
div-inv50.6%
metadata-eval50.6%
Applied egg-rr50.6%
associate-*r/50.6%
*-rgt-identity50.6%
*-commutative50.6%
Simplified50.6%
Final simplification50.6%
(FPCore (k n) :precision binary64 (/ (sqrt (* n (* 2.0 PI))) (sqrt k)))
double code(double k, double n) {
return sqrt((n * (2.0 * ((double) M_PI)))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((n * (2.0 * Math.PI))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((n * (2.0 * math.pi))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(n * Float64(2.0 * pi))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((n * (2.0 * pi))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(2 \cdot \pi\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
sqrt-unprod50.7%
associate-*r*50.7%
Applied egg-rr50.7%
Final simplification50.7%
(FPCore (k n) :precision binary64 (pow (* k (/ 0.5 (* n PI))) -0.5))
double code(double k, double n) {
return pow((k * (0.5 / (n * ((double) M_PI)))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k * (0.5 / (n * Math.PI))), -0.5);
}
def code(k, n): return math.pow((k * (0.5 / (n * math.pi))), -0.5)
function code(k, n) return Float64(k * Float64(0.5 / Float64(n * pi))) ^ -0.5 end
function tmp = code(k, n) tmp = (k * (0.5 / (n * pi))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k * N[(0.5 / N[(n * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{0.5}{n \cdot \pi}\right)}^{-0.5}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
Taylor expanded in n around 0 38.6%
*-commutative38.6%
*-rgt-identity38.6%
associate-*r/38.6%
associate-*r/38.6%
associate-*r/38.6%
*-rgt-identity38.6%
Simplified38.6%
associate-*r*38.6%
associate-*r/38.6%
*-commutative38.6%
associate-/l*38.7%
sqrt-undiv50.6%
clear-num50.6%
sqrt-undiv38.9%
associate-/r*38.9%
*-commutative38.9%
pow1/238.9%
pow-flip38.9%
associate-*r*38.9%
*-commutative38.9%
*-commutative38.9%
metadata-eval38.9%
Applied egg-rr38.9%
/-rgt-identity38.9%
*-commutative38.9%
associate-*r*38.9%
associate-/l*38.9%
metadata-eval38.9%
associate-/l*38.9%
associate-*r/38.9%
*-commutative38.9%
Simplified38.9%
Final simplification38.9%
(FPCore (k n) :precision binary64 (pow (/ k (* PI (* n 2.0))) -0.5))
double code(double k, double n) {
return pow((k / (((double) M_PI) * (n * 2.0))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / (Math.PI * (n * 2.0))), -0.5);
}
def code(k, n): return math.pow((k / (math.pi * (n * 2.0))), -0.5)
function code(k, n) return Float64(k / Float64(pi * Float64(n * 2.0))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (pi * (n * 2.0))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{\pi \cdot \left(n \cdot 2\right)}\right)}^{-0.5}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
Taylor expanded in n around 0 38.6%
*-commutative38.6%
*-rgt-identity38.6%
associate-*r/38.6%
associate-*r/38.6%
associate-*r/38.6%
*-rgt-identity38.6%
Simplified38.6%
associate-*r*38.6%
associate-*r/38.6%
*-commutative38.6%
associate-/l*38.7%
sqrt-undiv50.6%
clear-num50.6%
sqrt-undiv38.9%
associate-/r*38.9%
*-commutative38.9%
pow1/238.9%
pow-flip38.9%
associate-*r*38.9%
*-commutative38.9%
*-commutative38.9%
metadata-eval38.9%
Applied egg-rr38.9%
*-commutative38.9%
Simplified38.9%
Final simplification38.9%
(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%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
Taylor expanded in n around 0 38.6%
*-commutative38.6%
*-rgt-identity38.6%
associate-*r/38.6%
associate-*r/38.6%
associate-*r/38.6%
*-rgt-identity38.6%
Simplified38.6%
Taylor expanded in n around 0 38.6%
*-commutative38.6%
associate-*l/38.6%
*-commutative38.6%
Simplified38.6%
Final simplification38.6%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ PI (/ k n)))))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) / (k / n))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI / (k / n))));
}
def code(k, n): return math.sqrt((2.0 * (math.pi / (k / n))))
function code(k, n) return sqrt(Float64(2.0 * Float64(pi / Float64(k / n)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi / (k / n)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(Pi / N[(k / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi}{\frac{k}{n}}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
Taylor expanded in n around 0 38.6%
*-commutative38.6%
*-rgt-identity38.6%
associate-*r/38.6%
associate-*r/38.6%
associate-*r/38.6%
*-rgt-identity38.6%
Simplified38.6%
clear-num38.6%
un-div-inv38.6%
Applied egg-rr38.6%
Final simplification38.6%
(FPCore (k n) :precision binary64 (sqrt (/ n (* k (/ 0.5 PI)))))
double code(double k, double n) {
return sqrt((n / (k * (0.5 / ((double) M_PI)))));
}
public static double code(double k, double n) {
return Math.sqrt((n / (k * (0.5 / Math.PI))));
}
def code(k, n): return math.sqrt((n / (k * (0.5 / math.pi))))
function code(k, n) return sqrt(Float64(n / Float64(k * Float64(0.5 / pi)))) end
function tmp = code(k, n) tmp = sqrt((n / (k * (0.5 / pi)))); end
code[k_, n_] := N[Sqrt[N[(n / N[(k * N[(0.5 / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n}{k \cdot \frac{0.5}{\pi}}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
Taylor expanded in k around 0 38.7%
associate-*r/38.7%
*-commutative38.7%
associate-*r/38.7%
Simplified38.7%
Final simplification38.7%
(FPCore (k n) :precision binary64 (sqrt (/ n (/ (/ k 2.0) PI))))
double code(double k, double n) {
return sqrt((n / ((k / 2.0) / ((double) M_PI))));
}
public static double code(double k, double n) {
return Math.sqrt((n / ((k / 2.0) / Math.PI)));
}
def code(k, n): return math.sqrt((n / ((k / 2.0) / math.pi)))
function code(k, n) return sqrt(Float64(n / Float64(Float64(k / 2.0) / pi))) end
function tmp = code(k, n) tmp = sqrt((n / ((k / 2.0) / pi))); end
code[k_, n_] := N[Sqrt[N[(n / N[(N[(k / 2.0), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n}{\frac{\frac{k}{2}}{\pi}}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in k around 0 50.6%
expm1-log1p-u47.8%
expm1-udef42.3%
Applied egg-rr31.5%
expm1-def37.0%
expm1-log1p38.6%
associate-/l*38.7%
*-commutative38.7%
associate-/r*38.7%
Simplified38.7%
Final simplification38.7%
herbie shell --seed 2023336
(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))))