
(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 14 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) (* (sqrt (* PI n)) (sqrt 2.0))) (pow (* (* PI n) 2.0) (* k 0.5))))
double code(double k, double n) {
return (pow(k, -0.5) * (sqrt((((double) M_PI) * n)) * sqrt(2.0))) / pow(((((double) M_PI) * n) * 2.0), (k * 0.5));
}
public static double code(double k, double n) {
return (Math.pow(k, -0.5) * (Math.sqrt((Math.PI * n)) * Math.sqrt(2.0))) / Math.pow(((Math.PI * n) * 2.0), (k * 0.5));
}
def code(k, n): return (math.pow(k, -0.5) * (math.sqrt((math.pi * n)) * math.sqrt(2.0))) / math.pow(((math.pi * n) * 2.0), (k * 0.5))
function code(k, n) return Float64(Float64((k ^ -0.5) * Float64(sqrt(Float64(pi * n)) * sqrt(2.0))) / (Float64(Float64(pi * n) * 2.0) ^ Float64(k * 0.5))) end
function tmp = code(k, n) tmp = ((k ^ -0.5) * (sqrt((pi * n)) * sqrt(2.0))) / (((pi * n) * 2.0) ^ (k * 0.5)); end
code[k_, n_] := N[(N[(N[Power[k, -0.5], $MachinePrecision] * N[(N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(N[(Pi * n), $MachinePrecision] * 2.0), $MachinePrecision], N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{k}^{-0.5} \cdot \left(\sqrt{\pi \cdot n} \cdot \sqrt{2}\right)}{{\left(\left(\pi \cdot n\right) \cdot 2\right)}^{\left(k \cdot 0.5\right)}}
\end{array}
Initial program 99.1%
associate-*r*99.1%
div-sub99.1%
metadata-eval99.1%
pow-div99.0%
pow1/299.0%
associate-*r/99.2%
pow1/299.2%
pow-flip99.2%
metadata-eval99.2%
div-inv99.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
*-commutative99.2%
sqrt-prod99.5%
*-commutative99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* PI (* n 2.0))))
(if (<= k 2.4e-86)
(* (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-86) {
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-86) {
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-86: 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-86) 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-86) 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-86], 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^{-86}:\\
\;\;\;\;{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.40000000000000013e-86Initial program 99.4%
Taylor expanded in k around 0 66.1%
pow166.1%
sqrt-unprod66.4%
associate-/l*66.4%
Applied egg-rr66.4%
unpow166.4%
associate-*l*66.4%
Simplified66.4%
associate-*r*66.4%
sqrt-prod66.1%
associate-*r/66.1%
*-commutative66.1%
sqrt-undiv99.3%
associate-*l/99.3%
div-inv99.3%
metadata-eval99.3%
sqrt-div99.4%
*-commutative99.4%
inv-pow99.4%
sqrt-pow199.3%
metadata-eval99.3%
sqrt-unprod99.5%
associate-*l*99.5%
Applied egg-rr99.5%
if 2.40000000000000013e-86 < k Initial program 99.0%
add-sqr-sqrt98.9%
sqrt-unprod99.0%
*-commutative99.0%
associate-*r*99.0%
div-sub99.0%
metadata-eval99.0%
div-inv99.0%
*-commutative99.0%
Applied egg-rr99.0%
Simplified99.0%
Final simplification99.2%
(FPCore (k n) :precision binary64 (if (<= k 5.2e+100) (* (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 <= 5.2e+100) {
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 <= 5.2e+100) 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, 5.2e+100], 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 5.2 \cdot 10^{+100}:\\
\;\;\;\;{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 < 5.2000000000000003e100Initial program 98.7%
Taylor expanded in k around 0 55.6%
pow155.6%
sqrt-unprod55.8%
associate-/l*55.8%
Applied egg-rr55.8%
unpow155.8%
associate-*l*55.8%
Simplified55.8%
associate-*r*55.8%
sqrt-prod55.6%
associate-*r/55.6%
*-commutative55.6%
sqrt-undiv74.4%
associate-*l/74.4%
div-inv74.4%
metadata-eval74.4%
sqrt-div74.5%
*-commutative74.5%
inv-pow74.5%
sqrt-pow174.4%
metadata-eval74.4%
sqrt-unprod74.6%
associate-*l*74.6%
Applied egg-rr74.6%
if 5.2000000000000003e100 < k Initial program 100.0%
Taylor expanded in k around 0 2.7%
pow12.7%
sqrt-unprod2.7%
associate-/l*2.7%
Applied egg-rr2.7%
unpow12.7%
associate-*l*2.7%
Simplified2.7%
expm1-log1p-u2.7%
expm1-undefine29.6%
associate-*l/29.6%
associate-/l*29.6%
Applied egg-rr29.6%
sub-neg29.6%
metadata-eval29.6%
+-commutative29.6%
log1p-undefine29.6%
rem-exp-log29.6%
+-commutative29.6%
fma-define29.6%
Simplified29.6%
Final simplification60.2%
(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.1%
Taylor expanded in k around 0 99.2%
Final simplification99.2%
(FPCore (k n) :precision binary64 (/ 1.0 (* (sqrt k) (pow (* (* PI n) 2.0) (- (* k 0.5) 0.5)))))
double code(double k, double n) {
return 1.0 / (sqrt(k) * pow(((((double) M_PI) * n) * 2.0), ((k * 0.5) - 0.5)));
}
public static double code(double k, double n) {
return 1.0 / (Math.sqrt(k) * Math.pow(((Math.PI * n) * 2.0), ((k * 0.5) - 0.5)));
}
def code(k, n): return 1.0 / (math.sqrt(k) * math.pow(((math.pi * n) * 2.0), ((k * 0.5) - 0.5)))
function code(k, n) return Float64(1.0 / Float64(sqrt(k) * (Float64(Float64(pi * n) * 2.0) ^ Float64(Float64(k * 0.5) - 0.5)))) end
function tmp = code(k, n) tmp = 1.0 / (sqrt(k) * (((pi * n) * 2.0) ^ ((k * 0.5) - 0.5))); end
code[k_, n_] := N[(1.0 / N[(N[Sqrt[k], $MachinePrecision] * N[Power[N[(N[(Pi * n), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(k * 0.5), $MachinePrecision] - 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{k} \cdot {\left(\left(\pi \cdot n\right) \cdot 2\right)}^{\left(k \cdot 0.5 - 0.5\right)}}
\end{array}
Initial program 99.1%
associate-/r/99.1%
associate-*r*99.1%
div-sub99.1%
metadata-eval99.1%
div-inv99.1%
metadata-eval99.1%
Applied egg-rr99.1%
div-inv99.0%
pow-flip99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* PI (* n 2.0)) (+ 0.5 (* k -0.5)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((((double) M_PI) * (n * 2.0)), (0.5 + (k * -0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((Math.PI * (n * 2.0)), (0.5 + (k * -0.5)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((math.pi * (n * 2.0)), (0.5 + (k * -0.5)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(pi * Float64(n * 2.0)) ^ Float64(0.5 + Float64(k * -0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((pi * (n * 2.0)) ^ (0.5 + (k * -0.5))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(Pi * N[(n * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 + N[(k * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(\pi \cdot \left(n \cdot 2\right)\right)}^{\left(0.5 + k \cdot -0.5\right)}
\end{array}
Initial program 99.1%
associate-*l/99.2%
*-lft-identity99.2%
associate-*l*99.2%
div-sub99.2%
metadata-eval99.2%
Simplified99.2%
pow-div99.0%
pow1/299.0%
associate-/l/99.2%
*-un-lft-identity99.2%
frac-times99.0%
pow1/299.0%
pow-flip99.0%
metadata-eval99.0%
pow1/299.0%
pow-div99.2%
div-inv99.2%
metadata-eval99.2%
Applied egg-rr99.2%
*-commutative99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (k n) :precision binary64 (/ (pow (* (* PI n) 2.0) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow(((((double) M_PI) * n) * 2.0), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow(((Math.PI * n) * 2.0), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow(((math.pi * n) * 2.0), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(Float64(pi * n) * 2.0) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = (((pi * n) * 2.0) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(N[(Pi * n), $MachinePrecision] * 2.0), $MachinePrecision], N[(0.5 - N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\left(\pi \cdot n\right) \cdot 2\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.1%
associate-*l/99.2%
*-lft-identity99.2%
associate-*l*99.2%
div-sub99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.2%
(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 99.1%
Taylor expanded in k around 0 38.6%
pow138.6%
sqrt-unprod38.8%
associate-/l*38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*l*38.8%
Simplified38.8%
associate-*r*38.8%
sqrt-prod38.6%
associate-*r/38.6%
*-commutative38.6%
sqrt-undiv51.5%
associate-*l/51.5%
div-inv51.5%
metadata-eval51.5%
sqrt-div51.5%
*-commutative51.5%
inv-pow51.5%
sqrt-pow151.5%
metadata-eval51.5%
sqrt-unprod51.6%
associate-*l*51.6%
Applied egg-rr51.6%
Final simplification51.6%
(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 99.1%
Taylor expanded in k around 0 38.6%
pow138.6%
sqrt-unprod38.8%
associate-/l*38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*l*38.8%
Simplified38.8%
Taylor expanded in n around 0 38.8%
*-commutative38.8%
associate-*r/38.8%
associate-*l/38.7%
*-commutative38.7%
*-commutative38.7%
associate-*r*38.8%
Simplified38.8%
associate-*r*38.7%
*-commutative38.7%
sqrt-prod51.5%
Applied egg-rr51.5%
Final simplification51.5%
(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.1%
Taylor expanded in k around 0 38.6%
pow138.6%
sqrt-unprod38.8%
associate-/l*38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*l*38.8%
Simplified38.8%
sqrt-prod51.6%
*-commutative51.6%
associate-*l/51.6%
associate-/l*51.5%
Applied egg-rr51.5%
Final simplification51.5%
(FPCore (k n) :precision binary64 (* (sqrt (/ (* PI 2.0) k)) (sqrt n)))
double code(double k, double n) {
return sqrt(((((double) M_PI) * 2.0) / k)) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI * 2.0) / k)) * Math.sqrt(n);
}
def code(k, n): return math.sqrt(((math.pi * 2.0) / k)) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(Float64(pi * 2.0) / k)) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt(((pi * 2.0) / k)) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(N[(Pi * 2.0), $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi \cdot 2}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 38.6%
pow138.6%
sqrt-unprod38.8%
associate-/l*38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*l*38.8%
Simplified38.8%
Taylor expanded in n around 0 38.8%
*-commutative38.8%
associate-*r/38.8%
associate-*l/38.7%
*-commutative38.7%
*-commutative38.7%
associate-*r*38.8%
Simplified38.8%
*-commutative38.8%
sqrt-prod51.5%
*-commutative51.5%
associate-*l/51.6%
Applied egg-rr51.6%
Final simplification51.6%
(FPCore (k n) :precision binary64 (sqrt (* n (* PI (/ 2.0 k)))))
double code(double k, double n) {
return sqrt((n * (((double) M_PI) * (2.0 / k))));
}
public static double code(double k, double n) {
return Math.sqrt((n * (Math.PI * (2.0 / k))));
}
def code(k, n): return math.sqrt((n * (math.pi * (2.0 / k))))
function code(k, n) return sqrt(Float64(n * Float64(pi * Float64(2.0 / k)))) end
function tmp = code(k, n) tmp = sqrt((n * (pi * (2.0 / k)))); end
code[k_, n_] := N[Sqrt[N[(n * N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \left(\pi \cdot \frac{2}{k}\right)}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 38.6%
pow138.6%
sqrt-unprod38.8%
associate-/l*38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*l*38.8%
Simplified38.8%
Taylor expanded in n around 0 38.8%
*-commutative38.8%
associate-*r/38.8%
associate-*l/38.7%
*-commutative38.7%
*-commutative38.7%
associate-*r*38.8%
Simplified38.8%
Final simplification38.8%
(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(n * Float64(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 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \left(2 \cdot \frac{\pi}{k}\right)}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0 38.6%
pow138.6%
sqrt-unprod38.8%
associate-/l*38.8%
Applied egg-rr38.8%
unpow138.8%
associate-*l*38.8%
Simplified38.8%
Final simplification38.8%
(FPCore (k n) :precision binary64 (sqrt (/ 1.0 k)))
double code(double k, double n) {
return sqrt((1.0 / k));
}
real(8) function code(k, n)
real(8), intent (in) :: k
real(8), intent (in) :: n
code = sqrt((1.0d0 / k))
end function
public static double code(double k, double n) {
return Math.sqrt((1.0 / k));
}
def code(k, n): return math.sqrt((1.0 / k))
function code(k, n) return sqrt(Float64(1.0 / k)) end
function tmp = code(k, n) tmp = sqrt((1.0 / k)); end
code[k_, n_] := N[Sqrt[N[(1.0 / k), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{k}}
\end{array}
Initial program 99.1%
add-sqr-sqrt98.9%
sqrt-unprod86.3%
*-commutative86.3%
associate-*r*86.3%
div-sub86.3%
metadata-eval86.3%
div-inv86.3%
*-commutative86.3%
Applied egg-rr86.3%
Simplified86.4%
Applied egg-rr3.7%
*-inverses5.3%
Simplified5.3%
Final simplification5.3%
herbie shell --seed 2024112
(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))))