
(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 10 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) (* (sqrt k) (pow t_0 (* k 0.5))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k * 0.5)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k * 0.5)));
}
def code(k, n): t_0 = math.pi * (2.0 * n) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k * 0.5)))
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k * 0.5)))) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k * 0.5))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $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 := \pi \cdot \left(2 \cdot n\right)\\
\frac{\sqrt{t_0}}{\sqrt{k} \cdot {t_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (* (pow (* 2.0 (* PI n)) (- 0.5 (* k 0.5))) (pow k -0.5)))
double code(double k, double n) {
return pow((2.0 * (((double) M_PI) * n)), (0.5 - (k * 0.5))) * pow(k, -0.5);
}
public static double code(double k, double n) {
return Math.pow((2.0 * (Math.PI * n)), (0.5 - (k * 0.5))) * Math.pow(k, -0.5);
}
def code(k, n): return math.pow((2.0 * (math.pi * n)), (0.5 - (k * 0.5))) * math.pow(k, -0.5)
function code(k, n) return Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 - Float64(k * 0.5))) * (k ^ -0.5)) end
function tmp = code(k, n) tmp = ((2.0 * (pi * n)) ^ (0.5 - (k * 0.5))) * (k ^ -0.5); end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)} \cdot {k}^{-0.5}
\end{array}
Initial program 99.5%
associate-*l/99.5%
*-lft-identity99.5%
sqr-pow99.5%
pow-sqr99.5%
associate-*l*99.5%
*-commutative99.5%
associate-*l/99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
div-inv99.5%
div-inv99.5%
metadata-eval99.5%
pow1/299.5%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* 2.0 n))))
(if (<= k 2.05e-49)
(* (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) * (2.0 * n);
double tmp;
if (k <= 2.05e-49) {
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 * (2.0 * n);
double tmp;
if (k <= 2.05e-49) {
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 * (2.0 * n) tmp = 0 if k <= 2.05e-49: 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(2.0 * n)) tmp = 0.0 if (k <= 2.05e-49) 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 * (2.0 * n); tmp = 0.0; if (k <= 2.05e-49) 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[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2.05e-49], 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(2 \cdot n\right)\\
\mathbf{if}\;k \leq 2.05 \cdot 10^{-49}:\\
\;\;\;\;{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.0500000000000001e-49Initial program 99.3%
*-commutative99.3%
associate-*r*99.3%
div-sub99.3%
metadata-eval99.3%
div-inv99.3%
pow-sub99.3%
pow1/299.3%
associate-/l/99.3%
div-inv99.3%
metadata-eval99.3%
Applied egg-rr99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*l*99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*l*99.3%
Simplified99.3%
add-sqr-sqrt99.0%
sqrt-unprod71.8%
frac-times71.7%
add-sqr-sqrt71.8%
pow271.8%
pow1/271.8%
pow-unpow71.8%
pow-prod-down71.8%
Applied egg-rr71.8%
associate-/l*71.8%
unpow271.8%
unpow1/271.8%
unpow1/271.8%
rem-square-sqrt71.9%
Simplified71.9%
Taylor expanded in k around 0 72.0%
associate-/l*71.9%
associate-/r/72.0%
Simplified72.0%
metadata-eval72.0%
associate-*l/72.0%
*-commutative72.0%
times-frac72.0%
*-un-lft-identity72.0%
div-inv71.1%
sqrt-prod98.5%
associate-*r*98.5%
*-commutative98.5%
associate-*r*98.5%
inv-pow98.5%
metadata-eval98.5%
metadata-eval98.5%
metadata-eval98.5%
pow-prod-up98.5%
pow-pow98.4%
pow-pow98.2%
sqrt-unprod98.7%
add-sqr-sqrt99.0%
pow-pow99.3%
metadata-eval99.3%
Applied egg-rr99.3%
*-commutative99.3%
*-commutative99.3%
Simplified99.3%
if 2.0500000000000001e-49 < k Initial program 99.7%
add-sqr-sqrt99.6%
sqrt-unprod99.7%
*-commutative99.7%
div-inv99.7%
*-commutative99.7%
div-inv99.7%
frac-times99.7%
Applied egg-rr99.7%
Simplified99.7%
Final simplification99.6%
(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 99.5%
associate-*l/99.5%
*-lft-identity99.5%
sqr-pow99.5%
pow-sqr99.5%
associate-*l*99.5%
*-commutative99.5%
associate-*l/99.5%
associate-/l*99.5%
metadata-eval99.5%
/-rgt-identity99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (sqrt (* PI (* 2.0 n)))))
double code(double k, double n) {
return pow(k, -0.5) * sqrt((((double) M_PI) * (2.0 * n)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.sqrt((Math.PI * (2.0 * n)));
}
def code(k, n): return math.pow(k, -0.5) * math.sqrt((math.pi * (2.0 * n)))
function code(k, n) return Float64((k ^ -0.5) * sqrt(Float64(pi * Float64(2.0 * n)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * sqrt((pi * (2.0 * n))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot \sqrt{\pi \cdot \left(2 \cdot n\right)}
\end{array}
Initial program 99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
add-sqr-sqrt99.5%
sqrt-unprod87.3%
frac-times87.3%
add-sqr-sqrt87.3%
pow287.3%
pow1/287.3%
pow-unpow87.3%
pow-prod-down87.3%
Applied egg-rr87.3%
associate-/l*87.3%
unpow287.3%
unpow1/287.3%
unpow1/287.3%
rem-square-sqrt87.4%
Simplified87.4%
Taylor expanded in k around 0 38.9%
associate-/l*38.8%
associate-/r/38.9%
Simplified38.9%
metadata-eval38.9%
associate-*l/38.9%
*-commutative38.9%
times-frac38.9%
*-un-lft-identity38.9%
div-inv38.5%
sqrt-prod50.8%
associate-*r*50.8%
*-commutative50.8%
associate-*r*50.8%
inv-pow50.8%
metadata-eval50.8%
metadata-eval50.8%
metadata-eval50.8%
pow-prod-up50.8%
pow-pow50.8%
pow-pow50.7%
sqrt-unprod50.9%
add-sqr-sqrt51.0%
pow-pow51.2%
metadata-eval51.2%
Applied egg-rr51.2%
*-commutative51.2%
*-commutative51.2%
Simplified51.2%
Final simplification51.2%
(FPCore (k n) :precision binary64 (/ (sqrt (* n (* PI 2.0))) (sqrt k)))
double code(double k, double n) {
return sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt((n * (Math.PI * 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt((n * (math.pi * 2.0))) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((n * (pi * 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 51.1%
associate-*l/51.1%
*-un-lft-identity51.1%
sqrt-unprod51.2%
*-commutative51.2%
*-commutative51.2%
Applied egg-rr51.2%
associate-*r*51.2%
*-commutative51.2%
Simplified51.2%
Final simplification51.2%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (/ k PI) (* 2.0 n)))))
double code(double k, double n) {
return 1.0 / sqrt(((k / ((double) M_PI)) / (2.0 * n)));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt(((k / Math.PI) / (2.0 * n)));
}
def code(k, n): return 1.0 / math.sqrt(((k / math.pi) / (2.0 * n)))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(k / pi) / Float64(2.0 * n)))) end
function tmp = code(k, n) tmp = 1.0 / sqrt(((k / pi) / (2.0 * n))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(k / Pi), $MachinePrecision] / N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{\frac{k}{\pi}}{2 \cdot n}}}
\end{array}
Initial program 99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
add-sqr-sqrt99.5%
sqrt-unprod87.3%
frac-times87.3%
add-sqr-sqrt87.3%
pow287.3%
pow1/287.3%
pow-unpow87.3%
pow-prod-down87.3%
Applied egg-rr87.3%
associate-/l*87.3%
unpow287.3%
unpow1/287.3%
unpow1/287.3%
rem-square-sqrt87.4%
Simplified87.4%
Taylor expanded in k around 0 38.9%
associate-/l*38.8%
associate-/r/38.9%
Simplified38.9%
metadata-eval38.9%
associate-*l/38.9%
*-commutative38.9%
times-frac38.9%
*-un-lft-identity38.9%
clear-num38.9%
sqrt-div39.9%
metadata-eval39.9%
associate-*r*39.9%
*-commutative39.9%
associate-*r*39.9%
Applied egg-rr39.9%
associate-/r*39.8%
*-commutative39.8%
Simplified39.8%
Final simplification39.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(Float64(k / Float64(pi * 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[(N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{\frac{k}{\pi \cdot n}}{2}}}
\end{array}
Initial program 99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
add-sqr-sqrt99.5%
sqrt-unprod87.3%
frac-times87.3%
add-sqr-sqrt87.3%
pow287.3%
pow1/287.3%
pow-unpow87.3%
pow-prod-down87.3%
Applied egg-rr87.3%
associate-/l*87.3%
unpow287.3%
unpow1/287.3%
unpow1/287.3%
rem-square-sqrt87.4%
Simplified87.4%
Taylor expanded in k around 0 38.9%
associate-/l*38.8%
associate-/r/38.9%
Simplified38.9%
metadata-eval38.9%
associate-*l/38.9%
*-commutative38.9%
times-frac38.9%
*-un-lft-identity38.9%
clear-num38.9%
sqrt-div39.9%
metadata-eval39.9%
associate-*r*39.9%
*-commutative39.9%
associate-*r*39.9%
Applied egg-rr39.9%
associate-/r*39.8%
*-commutative39.8%
associate-/r*39.8%
associate-/l/39.9%
Simplified39.9%
Final simplification39.9%
(FPCore (k n) :precision binary64 (pow (/ (* PI (* 2.0 n)) k) 0.5))
double code(double k, double n) {
return pow(((((double) M_PI) * (2.0 * n)) / k), 0.5);
}
public static double code(double k, double n) {
return Math.pow(((Math.PI * (2.0 * n)) / k), 0.5);
}
def code(k, n): return math.pow(((math.pi * (2.0 * n)) / k), 0.5)
function code(k, n) return Float64(Float64(pi * Float64(2.0 * n)) / k) ^ 0.5 end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) / k) ^ 0.5; end
code[k_, n_] := N[Power[N[(N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], 0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{\pi \cdot \left(2 \cdot n\right)}{k}\right)}^{0.5}
\end{array}
Initial program 99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
add-sqr-sqrt99.5%
sqrt-unprod87.3%
frac-times87.3%
add-sqr-sqrt87.3%
pow287.3%
pow1/287.3%
pow-unpow87.3%
pow-prod-down87.3%
Applied egg-rr87.3%
associate-/l*87.3%
unpow287.3%
unpow1/287.3%
unpow1/287.3%
rem-square-sqrt87.4%
Simplified87.4%
Taylor expanded in k around 0 38.9%
associate-/l*38.8%
associate-/r/38.9%
Simplified38.9%
pow1/238.9%
metadata-eval38.9%
associate-*l/38.9%
*-commutative38.9%
times-frac38.9%
associate-*r*38.9%
*-commutative38.9%
associate-*r*38.9%
*-un-lft-identity38.9%
Applied egg-rr38.9%
Final simplification38.9%
(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.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
pow-sub99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
add-sqr-sqrt99.5%
sqrt-unprod87.3%
frac-times87.3%
add-sqr-sqrt87.3%
pow287.3%
pow1/287.3%
pow-unpow87.3%
pow-prod-down87.3%
Applied egg-rr87.3%
associate-/l*87.3%
unpow287.3%
unpow1/287.3%
unpow1/287.3%
rem-square-sqrt87.4%
Simplified87.4%
Taylor expanded in k around 0 38.9%
associate-/l*38.8%
associate-/r/38.9%
Simplified38.9%
Final simplification38.9%
herbie shell --seed 2023333
(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))))