
(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 n) PI))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = (2.0 * n) * ((double) M_PI);
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = (2.0 * n) * Math.PI;
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = (2.0 * n) * math.pi return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(Float64(2.0 * n) * pi) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = (2.0 * n) * pi; tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(N[(2.0 * n), $MachinePrecision] * Pi), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(N[Sqrt[k], $MachinePrecision] * N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(2 \cdot n\right) \cdot \pi\\
\frac{\sqrt{t_0}}{\sqrt{k} \cdot {t_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.6%
*-commutative99.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
div-inv99.7%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* (* 2.0 n) PI)))
(if (<= k 2.9e-33)
(/ (sqrt t_0) (sqrt k))
(/ 1.0 (sqrt (/ k (pow t_0 (- 1.0 k))))))))
double code(double k, double n) {
double t_0 = (2.0 * n) * ((double) M_PI);
double tmp;
if (k <= 2.9e-33) {
tmp = sqrt(t_0) / sqrt(k);
} 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 = (2.0 * n) * Math.PI;
double tmp;
if (k <= 2.9e-33) {
tmp = Math.sqrt(t_0) / Math.sqrt(k);
} else {
tmp = 1.0 / Math.sqrt((k / Math.pow(t_0, (1.0 - k))));
}
return tmp;
}
def code(k, n): t_0 = (2.0 * n) * math.pi tmp = 0 if k <= 2.9e-33: tmp = math.sqrt(t_0) / math.sqrt(k) else: tmp = 1.0 / math.sqrt((k / math.pow(t_0, (1.0 - k)))) return tmp
function code(k, n) t_0 = Float64(Float64(2.0 * n) * pi) tmp = 0.0 if (k <= 2.9e-33) tmp = Float64(sqrt(t_0) / sqrt(k)); 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 = (2.0 * n) * pi; tmp = 0.0; if (k <= 2.9e-33) tmp = sqrt(t_0) / sqrt(k); else tmp = 1.0 / sqrt((k / (t_0 ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(N[(2.0 * n), $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[k, 2.9e-33], N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[k], $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 := \left(2 \cdot n\right) \cdot \pi\\
\mathbf{if}\;k \leq 2.9 \cdot 10^{-33}:\\
\;\;\;\;\frac{\sqrt{t_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{{t_0}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 2.90000000000000003e-33Initial program 99.3%
Taylor expanded in k around 0 99.1%
associate-*l/99.2%
*-un-lft-identity99.2%
sqrt-unprod99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
Applied egg-rr99.4%
if 2.90000000000000003e-33 < k Initial program 99.8%
add-sqr-sqrt99.8%
sqrt-unprod99.8%
*-commutative99.8%
div-inv99.8%
*-commutative99.8%
div-inv99.8%
frac-times99.8%
Applied egg-rr99.8%
Simplified99.8%
clear-num99.8%
sqrt-div99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* (* 2.0 n) PI)))
(if (<= k 9.8e-30)
(/ (sqrt t_0) (sqrt k))
(sqrt (/ (pow t_0 (- 1.0 k)) k)))))
double code(double k, double n) {
double t_0 = (2.0 * n) * ((double) M_PI);
double tmp;
if (k <= 9.8e-30) {
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 = (2.0 * n) * Math.PI;
double tmp;
if (k <= 9.8e-30) {
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 = (2.0 * n) * math.pi tmp = 0 if k <= 9.8e-30: 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(Float64(2.0 * n) * pi) tmp = 0.0 if (k <= 9.8e-30) 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 = (2.0 * n) * pi; tmp = 0.0; if (k <= 9.8e-30) 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[(2.0 * n), $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[k, 9.8e-30], 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 := \left(2 \cdot n\right) \cdot \pi\\
\mathbf{if}\;k \leq 9.8 \cdot 10^{-30}:\\
\;\;\;\;\frac{\sqrt{t_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t_0}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 9.79999999999999942e-30Initial program 99.3%
Taylor expanded in k around 0 99.1%
associate-*l/99.2%
*-un-lft-identity99.2%
sqrt-unprod99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
Applied egg-rr99.4%
if 9.79999999999999942e-30 < k Initial program 99.9%
add-sqr-sqrt99.8%
sqrt-unprod99.9%
*-commutative99.9%
div-inv99.9%
*-commutative99.9%
div-inv99.9%
frac-times99.8%
Applied egg-rr99.8%
Simplified99.9%
Final simplification99.7%
(FPCore (k n) :precision binary64 (/ (pow (* 2.0 (* n PI)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((2.0 * (n * ((double) M_PI))), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((2.0 * (n * Math.PI)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((2.0 * (n * math.pi)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(2.0 * Float64(n * pi)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((2.0 * (n * pi)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(n * Pi), $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(n \cdot \pi\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.6%
associate-*l/99.7%
*-lft-identity99.7%
sqr-pow99.4%
pow-sqr99.7%
associate-*l*99.7%
*-commutative99.7%
associate-*l/99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
div-sub99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 5.8e+171) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (pow (pow (* n (/ PI (/ k 2.0))) 3.0) 0.16666666666666666)))
double code(double k, double n) {
double tmp;
if (k <= 5.8e+171) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} else {
tmp = pow(pow((n * (((double) M_PI) / (k / 2.0))), 3.0), 0.16666666666666666);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 5.8e+171) {
tmp = Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
} else {
tmp = Math.pow(Math.pow((n * (Math.PI / (k / 2.0))), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 5.8e+171: tmp = math.sqrt((math.pi / k)) * math.sqrt((2.0 * n)) else: tmp = math.pow(math.pow((n * (math.pi / (k / 2.0))), 3.0), 0.16666666666666666) return tmp
function code(k, n) tmp = 0.0 if (k <= 5.8e+171) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); else tmp = (Float64(n * Float64(pi / Float64(k / 2.0))) ^ 3.0) ^ 0.16666666666666666; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 5.8e+171) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); else tmp = ((n * (pi / (k / 2.0))) ^ 3.0) ^ 0.16666666666666666; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 5.8e+171], N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(n * N[(Pi / N[(k / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.8 \cdot 10^{+171}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(n \cdot \frac{\pi}{\frac{k}{2}}\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if k < 5.79999999999999969e171Initial program 99.5%
add-sqr-sqrt99.2%
sqrt-unprod80.2%
*-commutative80.2%
div-inv80.2%
*-commutative80.2%
div-inv80.3%
frac-times80.2%
Applied egg-rr80.3%
Simplified80.4%
Taylor expanded in k around 0 45.1%
associate-/l*45.1%
Simplified45.1%
associate-/r/45.1%
Applied egg-rr45.1%
associate-*l/45.1%
associate-*r/45.1%
associate-*r*45.1%
clear-num45.1%
div-inv45.1%
clear-num45.1%
associate-/r/45.1%
clear-num45.1%
sqrt-prod64.4%
Applied egg-rr64.4%
if 5.79999999999999969e171 < k Initial program 100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
*-commutative100.0%
div-inv100.0%
*-commutative100.0%
div-inv100.0%
frac-times100.0%
Applied egg-rr100.0%
Simplified100.0%
Taylor expanded in k around 0 3.0%
associate-/l*3.0%
Simplified3.0%
associate-/r/3.0%
Applied egg-rr3.0%
pow1/23.0%
associate-*l/3.0%
associate-*r/3.0%
metadata-eval3.0%
pow-pow11.4%
sqr-pow11.4%
pow-prod-down36.7%
pow-prod-up36.7%
associate-*r*36.7%
*-commutative36.7%
associate-*l*36.7%
metadata-eval36.7%
metadata-eval36.7%
Applied egg-rr36.7%
associate-*r/36.7%
*-commutative36.7%
associate-/l*36.7%
Simplified36.7%
Final simplification58.2%
(FPCore (k n) :precision binary64 (if (<= k 1.95e+239) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (cbrt (pow (* 2.0 (/ (* n PI) k)) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 1.95e+239) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} else {
tmp = cbrt(pow((2.0 * ((n * ((double) M_PI)) / k)), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.95e+239) {
tmp = Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
} else {
tmp = Math.cbrt(Math.pow((2.0 * ((n * Math.PI) / k)), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.95e+239) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); else tmp = cbrt((Float64(2.0 * Float64(Float64(n * pi) / k)) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.95e+239], N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(N[(n * Pi), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.95 \cdot 10^{+239}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \frac{n \cdot \pi}{k}\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 1.9499999999999999e239Initial program 99.5%
add-sqr-sqrt99.3%
sqrt-unprod82.5%
*-commutative82.5%
div-inv82.6%
*-commutative82.6%
div-inv82.6%
frac-times82.6%
Applied egg-rr82.6%
Simplified82.7%
Taylor expanded in k around 0 40.1%
associate-/l*40.1%
Simplified40.1%
associate-/r/40.1%
Applied egg-rr40.1%
associate-*l/40.1%
associate-*r/40.1%
associate-*r*40.1%
clear-num40.1%
div-inv40.1%
clear-num40.0%
associate-/r/40.1%
clear-num40.1%
sqrt-prod57.0%
Applied egg-rr57.0%
if 1.9499999999999999e239 < k Initial program 100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
*-commutative100.0%
div-inv100.0%
*-commutative100.0%
div-inv100.0%
frac-times100.0%
Applied egg-rr100.0%
Simplified100.0%
Taylor expanded in k around 0 3.2%
associate-/l*3.2%
Simplified3.2%
add-cbrt-cube19.1%
pow1/319.1%
add-sqr-sqrt19.1%
pow119.1%
pow1/219.1%
pow-prod-up19.1%
associate-/l*19.1%
div-inv19.1%
associate-*l*19.1%
div-inv19.1%
metadata-eval19.1%
Applied egg-rr19.1%
unpow1/319.1%
associate-*r/19.1%
Simplified19.1%
Final simplification52.6%
(FPCore (k n) :precision binary64 (* (sqrt (/ PI k)) (sqrt (* 2.0 n))))
double code(double k, double n) {
return sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
}
public static double code(double k, double n) {
return Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
}
def code(k, n): return math.sqrt((math.pi / k)) * math.sqrt((2.0 * n))
function code(k, n) return Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))) end
function tmp = code(k, n) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); end
code[k_, n_] := N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}
\end{array}
Initial program 99.6%
add-sqr-sqrt99.4%
sqrt-unprod84.6%
*-commutative84.6%
div-inv84.6%
*-commutative84.6%
div-inv84.7%
frac-times84.6%
Applied egg-rr84.7%
Simplified84.7%
Taylor expanded in k around 0 35.8%
associate-/l*35.7%
Simplified35.7%
associate-/r/35.8%
Applied egg-rr35.8%
associate-*l/35.8%
associate-*r/35.8%
associate-*r*35.8%
clear-num35.7%
div-inv35.7%
clear-num35.7%
associate-/r/35.7%
clear-num35.8%
sqrt-prod50.7%
Applied egg-rr50.7%
Final simplification50.7%
(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.6%
add-sqr-sqrt99.4%
sqrt-unprod84.6%
*-commutative84.6%
div-inv84.6%
*-commutative84.6%
div-inv84.7%
frac-times84.6%
Applied egg-rr84.7%
Simplified84.7%
Taylor expanded in k around 0 35.8%
associate-/l*35.7%
Simplified35.7%
associate-/r/35.8%
Applied egg-rr35.8%
associate-*l/35.8%
associate-*r/35.8%
associate-*r*35.8%
clear-num35.7%
div-inv35.7%
clear-num35.7%
inv-pow35.7%
sqrt-pow137.3%
associate-/l/37.3%
*-un-lft-identity37.3%
associate-*r*37.3%
*-commutative37.3%
times-frac37.3%
metadata-eval37.3%
metadata-eval37.3%
Applied egg-rr37.3%
Final simplification37.3%
(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(Float64(0.5 / 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[(N[(0.5 / n), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{\frac{0.5}{n}}{\pi}\right)}^{-0.5}
\end{array}
Initial program 99.6%
add-sqr-sqrt99.4%
sqrt-unprod84.6%
*-commutative84.6%
div-inv84.6%
*-commutative84.6%
div-inv84.7%
frac-times84.6%
Applied egg-rr84.7%
Simplified84.7%
Taylor expanded in k around 0 35.8%
associate-/l*35.7%
Simplified35.7%
associate-/r/35.8%
Applied egg-rr35.8%
associate-*l/35.8%
associate-*r/35.8%
associate-*r*35.8%
clear-num35.7%
div-inv35.7%
clear-num35.7%
inv-pow35.7%
sqrt-pow137.3%
associate-/l/37.3%
*-un-lft-identity37.3%
associate-*r*37.3%
*-commutative37.3%
times-frac37.3%
metadata-eval37.3%
metadata-eval37.3%
Applied egg-rr37.3%
associate-*r/37.3%
*-commutative37.3%
associate-*r/37.3%
*-commutative37.3%
associate-/r*37.3%
Simplified37.3%
Final simplification37.3%
(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(pi * Float64(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[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(\pi \cdot \frac{n}{k}\right)}
\end{array}
Initial program 99.6%
add-sqr-sqrt99.4%
sqrt-unprod84.6%
*-commutative84.6%
div-inv84.6%
*-commutative84.6%
div-inv84.7%
frac-times84.6%
Applied egg-rr84.7%
Simplified84.7%
Taylor expanded in k around 0 35.8%
associate-/l*35.7%
Simplified35.7%
associate-/r/35.8%
Applied egg-rr35.8%
Final simplification35.8%
(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(Float64(Float64(2.0 * n) * pi) / k)) end
function tmp = code(k, n) tmp = sqrt((((2.0 * n) * pi) / k)); end
code[k_, n_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * Pi), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\left(2 \cdot n\right) \cdot \pi}{k}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 50.6%
associate-*l/50.6%
*-un-lft-identity50.6%
sqrt-unprod50.7%
*-commutative50.7%
associate-*l*50.7%
sqrt-undiv35.8%
*-commutative35.8%
Applied egg-rr35.8%
Final simplification35.8%
herbie shell --seed 2023300
(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))))