
(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 (* 2.0 n)))) (/ (/ (sqrt t_0) (pow t_0 (* k 0.5))) (sqrt k))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return (sqrt(t_0) / pow(t_0, (k * 0.5))) / sqrt(k);
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
return (Math.sqrt(t_0) / Math.pow(t_0, (k * 0.5))) / Math.sqrt(k);
}
def code(k, n): t_0 = math.pi * (2.0 * n) return (math.sqrt(t_0) / math.pow(t_0, (k * 0.5))) / math.sqrt(k)
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(Float64(sqrt(t_0) / (t_0 ^ Float64(k * 0.5))) / sqrt(k)) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = (sqrt(t_0) / (t_0 ^ (k * 0.5))) / sqrt(k); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\frac{\frac{\sqrt{t_0}}{{t_0}^{\left(k \cdot 0.5\right)}}}{\sqrt{k}}
\end{array}
\end{array}
Initial program 99.5%
div-sub99.5%
metadata-eval99.5%
pow-sub99.6%
pow1/299.6%
associate-*l*99.6%
associate-*l*99.6%
div-inv99.6%
metadata-eval99.6%
Applied egg-rr99.6%
*-commutative99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*r*99.6%
Simplified99.6%
associate-*l/99.7%
*-un-lft-identity99.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 2.7e-20) (* (sqrt (+ n n)) (sqrt (/ PI k))) (/ 1.0 (sqrt (/ k (pow (* 2.0 (* PI n)) (- 1.0 k)))))))
double code(double k, double n) {
double tmp;
if (k <= 2.7e-20) {
tmp = sqrt((n + n)) * sqrt((((double) M_PI) / k));
} else {
tmp = 1.0 / sqrt((k / pow((2.0 * (((double) M_PI) * n)), (1.0 - k))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.7e-20) {
tmp = Math.sqrt((n + n)) * Math.sqrt((Math.PI / k));
} else {
tmp = 1.0 / Math.sqrt((k / Math.pow((2.0 * (Math.PI * n)), (1.0 - k))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2.7e-20: tmp = math.sqrt((n + n)) * math.sqrt((math.pi / k)) else: tmp = 1.0 / math.sqrt((k / math.pow((2.0 * (math.pi * n)), (1.0 - k)))) return tmp
function code(k, n) tmp = 0.0 if (k <= 2.7e-20) tmp = Float64(sqrt(Float64(n + n)) * sqrt(Float64(pi / k))); else tmp = Float64(1.0 / sqrt(Float64(k / (Float64(2.0 * Float64(pi * n)) ^ Float64(1.0 - k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.7e-20) tmp = sqrt((n + n)) * sqrt((pi / k)); else tmp = 1.0 / sqrt((k / ((2.0 * (pi * n)) ^ (1.0 - k)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.7e-20], N[(N[Sqrt[N[(n + n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sqrt[N[(k / N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.7 \cdot 10^{-20}:\\
\;\;\;\;\sqrt{n + n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{k}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}}}\\
\end{array}
\end{array}
if k < 2.7e-20Initial program 99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
div-inv99.3%
expm1-log1p-u93.8%
expm1-udef67.5%
Applied egg-rr40.9%
expm1-def67.3%
expm1-log1p70.0%
*-commutative70.0%
associate-*r*70.0%
Simplified70.0%
Taylor expanded in k around 0 70.0%
associate-/l*70.0%
Simplified70.0%
Taylor expanded in n around 0 70.0%
associate-/l*70.0%
*-rgt-identity70.0%
associate-*r/69.9%
associate-/r/70.0%
associate-*l/70.0%
*-lft-identity70.0%
Simplified70.0%
pow1/270.0%
associate-*r*70.0%
*-commutative70.0%
unpow-prod-down99.3%
pow1/299.3%
*-commutative99.3%
pow1/299.3%
Applied egg-rr99.3%
rem-log-exp7.0%
log-pow7.1%
unpow27.1%
log-prod7.0%
rem-log-exp15.0%
rem-log-exp99.3%
Simplified99.3%
if 2.7e-20 < k Initial program 99.8%
add-sqr-sqrt99.8%
sqrt-unprod99.8%
frac-times99.8%
metadata-eval99.8%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*r*99.8%
sqrt-pow199.8%
sqrt-prod99.8%
div-inv99.8%
clear-num99.8%
sqrt-div99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Final simplification99.6%
(FPCore (k n) :precision binary64 (* (sqrt (/ 1.0 k)) (pow (* n (* PI 2.0)) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return sqrt((1.0 / k)) * pow((n * (((double) M_PI) * 2.0)), ((1.0 - k) / 2.0));
}
public static double code(double k, double n) {
return Math.sqrt((1.0 / k)) * Math.pow((n * (Math.PI * 2.0)), ((1.0 - k) / 2.0));
}
def code(k, n): return math.sqrt((1.0 / k)) * math.pow((n * (math.pi * 2.0)), ((1.0 - k) / 2.0))
function code(k, n) return Float64(sqrt(Float64(1.0 / k)) * (Float64(n * Float64(pi * 2.0)) ^ Float64(Float64(1.0 - k) / 2.0))) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)) * ((n * (pi * 2.0)) ^ ((1.0 - k) / 2.0)); end
code[k_, n_] := N[(N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision] * N[Power[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{k}} \cdot {\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.5%
add-sqr-sqrt99.4%
sqrt-unprod99.5%
frac-times99.6%
metadata-eval99.6%
add-sqr-sqrt99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (* (pow (* n (* PI 2.0)) (/ (- 1.0 k) 2.0)) (pow k -0.5)))
double code(double k, double n) {
return pow((n * (((double) M_PI) * 2.0)), ((1.0 - k) / 2.0)) * pow(k, -0.5);
}
public static double code(double k, double n) {
return Math.pow((n * (Math.PI * 2.0)), ((1.0 - k) / 2.0)) * Math.pow(k, -0.5);
}
def code(k, n): return math.pow((n * (math.pi * 2.0)), ((1.0 - k) / 2.0)) * math.pow(k, -0.5)
function code(k, n) return Float64((Float64(n * Float64(pi * 2.0)) ^ Float64(Float64(1.0 - k) / 2.0)) * (k ^ -0.5)) end
function tmp = code(k, n) tmp = ((n * (pi * 2.0)) ^ ((1.0 - k) / 2.0)) * (k ^ -0.5); end
code[k_, n_] := N[(N[Power[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - k), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(n \cdot \left(\pi \cdot 2\right)\right)}^{\left(\frac{1 - k}{2}\right)} \cdot {k}^{-0.5}
\end{array}
Initial program 99.5%
expm1-log1p-u96.4%
expm1-udef76.5%
pow1/276.5%
pow-flip76.5%
metadata-eval76.5%
Applied egg-rr76.5%
expm1-def96.4%
expm1-log1p99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 1e-21) (* (sqrt (+ n n)) (sqrt (/ PI k))) (sqrt (/ (pow (* PI (* 2.0 n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 1e-21) {
tmp = sqrt((n + n)) * sqrt((((double) M_PI) / k));
} else {
tmp = sqrt((pow((((double) M_PI) * (2.0 * n)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1e-21) {
tmp = Math.sqrt((n + n)) * Math.sqrt((Math.PI / k));
} else {
tmp = Math.sqrt((Math.pow((Math.PI * (2.0 * n)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1e-21: tmp = math.sqrt((n + n)) * math.sqrt((math.pi / k)) else: tmp = math.sqrt((math.pow((math.pi * (2.0 * n)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 1e-21) tmp = Float64(sqrt(Float64(n + n)) * sqrt(Float64(pi / k))); else tmp = sqrt(Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1e-21) tmp = sqrt((n + n)) * sqrt((pi / k)); else tmp = sqrt((((pi * (2.0 * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1e-21], N[(N[Sqrt[N[(n + n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 10^{-21}:\\
\;\;\;\;\sqrt{n + n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 9.99999999999999908e-22Initial program 99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
div-inv99.3%
expm1-log1p-u93.8%
expm1-udef67.5%
Applied egg-rr40.9%
expm1-def67.3%
expm1-log1p70.0%
*-commutative70.0%
associate-*r*70.0%
Simplified70.0%
Taylor expanded in k around 0 70.0%
associate-/l*70.0%
Simplified70.0%
Taylor expanded in n around 0 70.0%
associate-/l*70.0%
*-rgt-identity70.0%
associate-*r/69.9%
associate-/r/70.0%
associate-*l/70.0%
*-lft-identity70.0%
Simplified70.0%
pow1/270.0%
associate-*r*70.0%
*-commutative70.0%
unpow-prod-down99.3%
pow1/299.3%
*-commutative99.3%
pow1/299.3%
Applied egg-rr99.3%
rem-log-exp7.0%
log-pow7.1%
unpow27.1%
log-prod7.0%
rem-log-exp15.0%
rem-log-exp99.3%
Simplified99.3%
if 9.99999999999999908e-22 < k Initial program 99.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
div-inv99.8%
expm1-log1p-u99.8%
expm1-udef97.5%
Applied egg-rr97.5%
expm1-def99.8%
expm1-log1p99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* PI (* 2.0 n)) (/ (- 1.0 k) 2.0)) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), ((1.0 - k) / 2.0)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), ((1.0 - k) / 2.0)) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), ((1.0 - k) / 2.0)) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(Float64(1.0 - k) / 2.0)) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ ((1.0 - k) / 2.0)) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $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(2 \cdot n\right)\right)}^{\left(\frac{1 - k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
associate-*l/99.6%
*-lft-identity99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 4.2e+223) (* (sqrt (+ n n)) (sqrt (/ PI k))) (cbrt (pow (* 2.0 (* n (/ PI k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 4.2e+223) {
tmp = sqrt((n + n)) * sqrt((((double) M_PI) / k));
} 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 <= 4.2e+223) {
tmp = Math.sqrt((n + n)) * Math.sqrt((Math.PI / k));
} 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 <= 4.2e+223) tmp = Float64(sqrt(Float64(n + n)) * sqrt(Float64(pi / k))); else tmp = cbrt((Float64(2.0 * Float64(n * Float64(pi / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 4.2e+223], N[(N[Sqrt[N[(n + n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(n * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.2 \cdot 10^{+223}:\\
\;\;\;\;\sqrt{n + n} \cdot \sqrt{\frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(n \cdot \frac{\pi}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 4.19999999999999981e223Initial program 99.4%
*-commutative99.4%
*-commutative99.4%
associate-*r*99.4%
div-inv99.5%
expm1-log1p-u96.6%
expm1-udef81.5%
Applied egg-rr67.6%
expm1-def82.8%
expm1-log1p84.2%
*-commutative84.2%
associate-*r*84.2%
Simplified84.2%
Taylor expanded in k around 0 39.9%
associate-/l*39.9%
Simplified39.9%
Taylor expanded in n around 0 39.9%
associate-/l*39.9%
*-rgt-identity39.9%
associate-*r/39.8%
associate-/r/39.9%
associate-*l/39.9%
*-lft-identity39.9%
Simplified39.9%
pow1/239.9%
associate-*r*39.9%
*-commutative39.9%
unpow-prod-down55.1%
pow1/255.1%
*-commutative55.1%
pow1/255.1%
Applied egg-rr55.1%
rem-log-exp4.5%
log-pow4.5%
unpow24.5%
log-prod4.5%
rem-log-exp9.1%
rem-log-exp55.1%
Simplified55.1%
if 4.19999999999999981e223 < 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%
Simplified100.0%
Taylor expanded in k around 0 2.7%
associate-/l*2.7%
Simplified2.7%
Taylor expanded in n around 0 2.7%
associate-/l*2.7%
*-rgt-identity2.7%
associate-*r/2.7%
associate-/r/2.7%
associate-*l/2.7%
*-lft-identity2.7%
Simplified2.7%
clear-num2.7%
un-div-inv2.7%
div-inv2.7%
add-cbrt-cube15.6%
add-sqr-sqrt15.6%
div-inv15.6%
un-div-inv15.6%
clear-num15.6%
pow115.6%
pow1/215.6%
Applied egg-rr15.6%
Final simplification49.4%
(FPCore (k n) :precision binary64 (* (sqrt (+ n n)) (sqrt (/ PI k))))
double code(double k, double n) {
return sqrt((n + n)) * sqrt((((double) M_PI) / k));
}
public static double code(double k, double n) {
return Math.sqrt((n + n)) * Math.sqrt((Math.PI / k));
}
def code(k, n): return math.sqrt((n + n)) * math.sqrt((math.pi / k))
function code(k, n) return Float64(sqrt(Float64(n + n)) * sqrt(Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt((n + n)) * sqrt((pi / k)); end
code[k_, n_] := N[(N[Sqrt[N[(n + n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n + n} \cdot \sqrt{\frac{\pi}{k}}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u97.1%
expm1-udef84.2%
Applied egg-rr72.3%
expm1-def85.3%
expm1-log1p86.5%
*-commutative86.5%
associate-*r*86.5%
Simplified86.5%
Taylor expanded in k around 0 34.5%
associate-/l*34.5%
Simplified34.5%
Taylor expanded in n around 0 34.5%
associate-/l*34.5%
*-rgt-identity34.5%
associate-*r/34.5%
associate-/r/34.5%
associate-*l/34.5%
*-lft-identity34.5%
Simplified34.5%
pow1/234.5%
associate-*r*34.5%
*-commutative34.5%
unpow-prod-down47.6%
pow1/247.6%
*-commutative47.6%
pow1/247.6%
Applied egg-rr47.6%
rem-log-exp4.1%
log-pow4.1%
unpow24.1%
log-prod4.1%
rem-log-exp8.0%
rem-log-exp47.6%
Simplified47.6%
Final simplification47.6%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (* n (* PI (/ 1.0 k))))))
double code(double k, double n) {
return sqrt((2.0 * (n * (((double) M_PI) * (1.0 / k)))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (n * (Math.PI * (1.0 / k)))));
}
def code(k, n): return math.sqrt((2.0 * (n * (math.pi * (1.0 / k)))))
function code(k, n) return sqrt(Float64(2.0 * Float64(n * Float64(pi * Float64(1.0 / k))))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (n * (pi * (1.0 / k))))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n * N[(Pi * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \left(n \cdot \left(\pi \cdot \frac{1}{k}\right)\right)}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u97.1%
expm1-udef84.2%
Applied egg-rr72.3%
expm1-def85.3%
expm1-log1p86.5%
*-commutative86.5%
associate-*r*86.5%
Simplified86.5%
Taylor expanded in k around 0 34.5%
associate-/l*34.5%
Simplified34.5%
Taylor expanded in n around 0 34.5%
associate-/l*34.5%
*-rgt-identity34.5%
associate-*r/34.5%
associate-/r/34.5%
associate-*l/34.5%
*-lft-identity34.5%
Simplified34.5%
div-inv34.5%
Applied egg-rr34.5%
Final simplification34.5%
(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%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u97.1%
expm1-udef84.2%
Applied egg-rr72.3%
expm1-def85.3%
expm1-log1p86.5%
*-commutative86.5%
associate-*r*86.5%
Simplified86.5%
Taylor expanded in k around 0 34.5%
associate-/l*34.5%
Simplified34.5%
Taylor expanded in n around 0 34.5%
associate-/l*34.5%
*-rgt-identity34.5%
associate-*r/34.5%
associate-/r/34.5%
associate-*l/34.5%
*-lft-identity34.5%
Simplified34.5%
Final simplification34.5%
(FPCore (k n) :precision binary64 (sqrt (/ (* PI n) (/ k 2.0))))
double code(double k, double n) {
return sqrt(((((double) M_PI) * n) / (k / 2.0)));
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI * n) / (k / 2.0)));
}
def code(k, n): return math.sqrt(((math.pi * n) / (k / 2.0)))
function code(k, n) return sqrt(Float64(Float64(pi * n) / Float64(k / 2.0))) end
function tmp = code(k, n) tmp = sqrt(((pi * n) / (k / 2.0))); end
code[k_, n_] := N[Sqrt[N[(N[(Pi * n), $MachinePrecision] / N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi \cdot n}{\frac{k}{2}}}
\end{array}
Initial program 99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
div-inv99.6%
expm1-log1p-u97.1%
expm1-udef84.2%
Applied egg-rr72.3%
expm1-def85.3%
expm1-log1p86.5%
*-commutative86.5%
associate-*r*86.5%
Simplified86.5%
Taylor expanded in k around 0 34.5%
associate-*r/34.5%
*-commutative34.5%
*-commutative34.5%
associate-/l*34.5%
Simplified34.5%
Final simplification34.5%
herbie shell --seed 2023229
(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))))