
(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 12 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 (if (<= k 2.1e-74) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (sqrt (/ (pow (* PI (* 2.0 n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 2.1e-74) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} 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 <= 2.1e-74) {
tmp = Math.sqrt((Math.PI / k)) * Math.sqrt((2.0 * n));
} 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 <= 2.1e-74: tmp = math.sqrt((math.pi / k)) * math.sqrt((2.0 * n)) 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 <= 2.1e-74) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); 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 <= 2.1e-74) tmp = sqrt((pi / k)) * sqrt((2.0 * n)); else tmp = sqrt((((pi * (2.0 * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.1e-74], N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $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 2.1 \cdot 10^{-74}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 2.1e-74Initial program 99.3%
Taylor expanded in k around 0 68.3%
associate-/l*68.3%
Simplified68.3%
*-commutative68.3%
sqrt-unprod68.6%
Applied egg-rr68.6%
associate-*r*68.6%
sqrt-prod99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 2.1e-74 < k Initial program 99.7%
add-sqr-sqrt99.7%
sqrt-unprod99.7%
*-commutative99.7%
associate-*r*99.7%
div-sub99.7%
metadata-eval99.7%
div-inv99.8%
*-commutative99.8%
Applied egg-rr99.8%
Simplified99.8%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* PI (* 2.0 n)))) (* (* (sqrt t_0) (pow t_0 (* k -0.5))) (pow k -0.5))))
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))) * pow(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.pow(t_0, (k * -0.5))) * Math.pow(k, -0.5);
}
def code(k, n): t_0 = math.pi * (2.0 * n) return (math.sqrt(t_0) * math.pow(t_0, (k * -0.5))) * math.pow(k, -0.5)
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(Float64(sqrt(t_0) * (t_0 ^ Float64(k * -0.5))) * (k ^ -0.5)) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = (sqrt(t_0) * (t_0 ^ (k * -0.5))) * (k ^ -0.5); 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[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\left(\sqrt{t\_0} \cdot {t\_0}^{\left(k \cdot -0.5\right)}\right) \cdot {k}^{-0.5}
\end{array}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
div-inv99.6%
div-inv99.6%
metadata-eval99.6%
inv-pow99.6%
sqrt-pow299.6%
metadata-eval99.6%
Applied egg-rr99.6%
sub-neg99.6%
unpow-prod-up99.7%
pow1/299.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* PI 2.0)))) (/ (sqrt t_0) (sqrt (* k (pow t_0 k))))))
double code(double k, double n) {
double t_0 = n * (((double) M_PI) * 2.0);
return sqrt(t_0) / sqrt((k * pow(t_0, k)));
}
public static double code(double k, double n) {
double t_0 = n * (Math.PI * 2.0);
return Math.sqrt(t_0) / Math.sqrt((k * Math.pow(t_0, k)));
}
def code(k, n): t_0 = n * (math.pi * 2.0) return math.sqrt(t_0) / math.sqrt((k * math.pow(t_0, k)))
function code(k, n) t_0 = Float64(n * Float64(pi * 2.0)) return Float64(sqrt(t_0) / sqrt(Float64(k * (t_0 ^ k)))) end
function tmp = code(k, n) t_0 = n * (pi * 2.0); tmp = sqrt(t_0) / sqrt((k * (t_0 ^ k))); end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[N[(k * N[Power[t$95$0, k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(\pi \cdot 2\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k \cdot {t\_0}^{k}}}
\end{array}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
associate-*r*99.6%
div-sub99.6%
metadata-eval99.6%
pow-div99.7%
pow1/299.7%
associate-/l/99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
remove-double-neg99.7%
*-commutative99.7%
distribute-neg-frac99.7%
distribute-frac-neg299.7%
distribute-lft-neg-in99.7%
associate-/r*99.7%
Simplified99.7%
associate-/l/99.7%
div-inv99.7%
associate-*l*99.7%
pow1/299.7%
pow-unpow99.7%
pow-prod-down99.7%
associate-*l*99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
unpow1/299.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 7.4e+25) (* (sqrt (/ PI k)) (sqrt (* 2.0 n))) (sqrt (* 2.0 (+ -1.0 (fma n (/ PI k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 7.4e+25) {
tmp = sqrt((((double) M_PI) / k)) * sqrt((2.0 * n));
} else {
tmp = sqrt((2.0 * (-1.0 + fma(n, (((double) M_PI) / k), 1.0))));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 7.4e+25) tmp = Float64(sqrt(Float64(pi / k)) * sqrt(Float64(2.0 * n))); else tmp = sqrt(Float64(2.0 * Float64(-1.0 + fma(n, Float64(pi / k), 1.0)))); end return tmp end
code[k_, n_] := If[LessEqual[k, 7.4e+25], N[(N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(-1.0 + N[(n * N[(Pi / k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 7.4 \cdot 10^{+25}:\\
\;\;\;\;\sqrt{\frac{\pi}{k}} \cdot \sqrt{2 \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(-1 + \mathsf{fma}\left(n, \frac{\pi}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 7.3999999999999998e25Initial program 99.2%
Taylor expanded in k around 0 69.9%
associate-/l*69.9%
Simplified69.9%
*-commutative69.9%
sqrt-unprod70.2%
Applied egg-rr70.2%
associate-*r*70.2%
sqrt-prod93.4%
*-commutative93.4%
Applied egg-rr93.4%
if 7.3999999999999998e25 < k Initial program 100.0%
Taylor expanded in k around 0 2.6%
associate-/l*2.6%
Simplified2.6%
*-commutative2.6%
sqrt-unprod2.6%
Applied egg-rr2.6%
Taylor expanded in n around 0 2.6%
*-commutative2.6%
associate-/l*2.6%
Simplified2.6%
associate-*r/2.6%
clear-num2.6%
expm1-log1p-u2.6%
expm1-undefine21.7%
clear-num21.7%
associate-*r/21.7%
clear-num21.7%
un-div-inv21.7%
Applied egg-rr21.7%
sub-neg21.7%
metadata-eval21.7%
+-commutative21.7%
log1p-undefine21.7%
rem-exp-log21.7%
+-commutative21.7%
associate-/r/21.7%
*-commutative21.7%
fma-define21.7%
Simplified21.7%
Final simplification60.1%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (- 0.5 (* k 0.5)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), (0.5 - (k * 0.5)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), (0.5 - (k * 0.5)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), (0.5 - (k * 0.5)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 - Float64(k * 0.5)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ (0.5 - (k * 0.5))); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 - k \cdot 0.5\right)}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
div-inv99.6%
div-inv99.6%
metadata-eval99.6%
inv-pow99.6%
sqrt-pow299.6%
metadata-eval99.6%
Applied egg-rr99.6%
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.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.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%
Taylor expanded in k around 0 38.6%
associate-/l*38.6%
Simplified38.6%
*-commutative38.6%
sqrt-unprod38.8%
Applied egg-rr38.8%
associate-*r*38.8%
sqrt-prod51.2%
*-commutative51.2%
Applied egg-rr51.2%
Final simplification51.2%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (* 0.5 (/ k n)) PI))))
double code(double k, double n) {
return 1.0 / sqrt(((0.5 * (k / n)) / ((double) M_PI)));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt(((0.5 * (k / n)) / Math.PI));
}
def code(k, n): return 1.0 / math.sqrt(((0.5 * (k / n)) / math.pi))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(0.5 * Float64(k / n)) / pi))) end
function tmp = code(k, n) tmp = 1.0 / sqrt(((0.5 * (k / n)) / pi)); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(0.5 * N[(k / n), $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{0.5 \cdot \frac{k}{n}}{\pi}}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 38.6%
associate-/l*38.6%
Simplified38.6%
*-commutative38.6%
sqrt-unprod38.8%
Applied egg-rr38.8%
Taylor expanded in n around 0 38.7%
*-commutative38.7%
associate-/l*38.7%
Simplified38.7%
add-sqr-sqrt38.7%
add-sqr-sqrt38.7%
associate-*r/38.7%
clear-num38.7%
div-inv38.7%
sqrt-div38.9%
associate-/r*38.9%
clear-num38.9%
sqrt-undiv38.9%
associate-/r*38.9%
div-inv38.9%
*-commutative38.9%
metadata-eval38.9%
Applied egg-rr38.9%
*-commutative38.9%
associate-/r*38.9%
associate-*r/38.9%
Simplified38.9%
Final simplification38.9%
(FPCore (k n) :precision binary64 (/ 1.0 (sqrt (/ (/ k 2.0) (* PI n)))))
double code(double k, double n) {
return 1.0 / sqrt(((k / 2.0) / (((double) M_PI) * n)));
}
public static double code(double k, double n) {
return 1.0 / Math.sqrt(((k / 2.0) / (Math.PI * n)));
}
def code(k, n): return 1.0 / math.sqrt(((k / 2.0) / (math.pi * n)))
function code(k, n) return Float64(1.0 / sqrt(Float64(Float64(k / 2.0) / Float64(pi * n)))) end
function tmp = code(k, n) tmp = 1.0 / sqrt(((k / 2.0) / (pi * n))); end
code[k_, n_] := N[(1.0 / N[Sqrt[N[(N[(k / 2.0), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{\frac{\frac{k}{2}}{\pi \cdot n}}}
\end{array}
Initial program 99.6%
associate-*l/99.6%
*-lft-identity99.6%
associate-*l*99.6%
div-sub99.6%
metadata-eval99.6%
Simplified99.6%
div-inv99.6%
div-inv99.6%
metadata-eval99.6%
inv-pow99.6%
sqrt-pow299.6%
metadata-eval99.6%
Applied egg-rr99.6%
sub-neg99.6%
*-commutative99.6%
*-commutative99.6%
sub-neg99.6%
exp-to-pow96.4%
metadata-eval96.4%
pow-flip96.4%
pow1/296.4%
div-inv96.4%
clear-num96.4%
exp-to-pow99.6%
Applied egg-rr99.6%
Taylor expanded in k around 0 38.8%
associate-*r/38.9%
*-rgt-identity38.9%
associate-/l/38.9%
Simplified38.9%
clear-num38.9%
associate-/r*38.9%
sqrt-div38.7%
un-div-inv38.7%
metadata-eval38.7%
clear-num38.7%
times-frac38.7%
*-commutative38.7%
associate-*l*38.7%
*-un-lft-identity38.7%
sqrt-div51.1%
clear-num51.1%
sqrt-undiv38.9%
associate-*l*38.9%
Applied egg-rr38.9%
associate-/r*38.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.6%
Taylor expanded in k around 0 38.6%
associate-/l*38.6%
Simplified38.6%
*-commutative38.6%
sqrt-unprod38.8%
Applied egg-rr38.8%
Final simplification38.8%
(FPCore (k n) :precision binary64 (sqrt (* 2.0 (/ n (/ k PI)))))
double code(double k, double n) {
return sqrt((2.0 * (n / (k / ((double) M_PI)))));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (n / (k / Math.PI))));
}
def code(k, n): return math.sqrt((2.0 * (n / (k / math.pi))))
function code(k, n) return sqrt(Float64(2.0 * Float64(n / Float64(k / pi)))) end
function tmp = code(k, n) tmp = sqrt((2.0 * (n / (k / pi)))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(n / N[(k / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{n}{\frac{k}{\pi}}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0 38.6%
associate-/l*38.6%
Simplified38.6%
*-commutative38.6%
sqrt-unprod38.8%
Applied egg-rr38.8%
clear-num38.7%
un-div-inv38.8%
Applied egg-rr38.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.6%
Taylor expanded in k around 0 38.6%
associate-/l*38.6%
Simplified38.6%
*-commutative38.6%
sqrt-unprod38.8%
Applied egg-rr38.8%
*-un-lft-identity38.8%
sqrt-prod38.6%
sqrt-prod51.0%
div-inv51.0%
sqrt-prod38.6%
*-commutative38.6%
*-commutative38.6%
sqrt-prod51.0%
div-inv51.0%
associate-*r*51.1%
sqrt-prod51.2%
sqrt-prod38.8%
associate-*r*38.8%
*-commutative38.8%
associate-*l/38.7%
Applied egg-rr38.7%
*-lft-identity38.7%
*-commutative38.7%
*-commutative38.7%
associate-/l*38.8%
associate-*l*38.8%
Simplified38.8%
Final simplification38.8%
herbie shell --seed 2024074
(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))))