
(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 13 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.9e-59) (* (sqrt (* 2.0 (/ PI k))) (sqrt n)) (sqrt (/ (pow (* PI (* 2.0 n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 2.9e-59) {
tmp = sqrt((2.0 * (((double) M_PI) / k))) * sqrt(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.9e-59) {
tmp = Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(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.9e-59: tmp = math.sqrt((2.0 * (math.pi / k))) * math.sqrt(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.9e-59) tmp = Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(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.9e-59) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); else tmp = sqrt((((pi * (2.0 * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.9e-59], N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $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.9 \cdot 10^{-59}:\\
\;\;\;\;\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{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.90000000000000016e-59Initial program 98.0%
Taylor expanded in k around 0 65.4%
*-commutative65.4%
associate-/l*65.4%
Simplified65.4%
sqrt-unprod65.6%
Applied egg-rr65.6%
*-commutative65.6%
associate-*r*65.6%
sqrt-prod99.4%
Applied egg-rr99.4%
if 2.90000000000000016e-59 < k Initial program 99.5%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
*-commutative99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
div-inv99.5%
*-commutative99.5%
Applied egg-rr99.5%
Simplified99.6%
Final simplification99.5%
(FPCore (k n) :precision binary64 (let* ((t_0 (* 2.0 (* PI n)))) (/ (* (pow k -0.5) (sqrt t_0)) (pow t_0 (* k 0.5)))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return (pow(k, -0.5) * sqrt(t_0)) / pow(t_0, (k * 0.5));
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI * n);
return (Math.pow(k, -0.5) * Math.sqrt(t_0)) / Math.pow(t_0, (k * 0.5));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.pow(k, -0.5) * math.sqrt(t_0)) / math.pow(t_0, (k * 0.5))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64((k ^ -0.5) * sqrt(t_0)) / (t_0 ^ Float64(k * 0.5))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = ((k ^ -0.5) * sqrt(t_0)) / (t_0 ^ (k * 0.5)); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[k, -0.5], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, N[(k * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{{k}^{-0.5} \cdot \sqrt{t\_0}}{{t\_0}^{\left(k \cdot 0.5\right)}}
\end{array}
\end{array}
Initial program 98.8%
associate-*r*98.8%
div-sub98.8%
metadata-eval98.8%
pow-div98.8%
pow1/298.8%
associate-*r/98.8%
inv-pow98.8%
sqrt-pow298.9%
metadata-eval98.9%
div-inv98.9%
metadata-eval98.9%
Applied egg-rr98.9%
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* 2.0 PI)))) (/ (sqrt t_0) (sqrt (* k (pow t_0 k))))))
double code(double k, double n) {
double t_0 = n * (2.0 * ((double) M_PI));
return sqrt(t_0) / sqrt((k * pow(t_0, k)));
}
public static double code(double k, double n) {
double t_0 = n * (2.0 * Math.PI);
return Math.sqrt(t_0) / Math.sqrt((k * Math.pow(t_0, k)));
}
def code(k, n): t_0 = n * (2.0 * math.pi) return math.sqrt(t_0) / math.sqrt((k * math.pow(t_0, k)))
function code(k, n) t_0 = Float64(n * Float64(2.0 * pi)) return Float64(sqrt(t_0) / sqrt(Float64(k * (t_0 ^ k)))) end
function tmp = code(k, n) t_0 = n * (2.0 * pi); tmp = sqrt(t_0) / sqrt((k * (t_0 ^ k))); end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(2.0 * Pi), $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(2 \cdot \pi\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k \cdot {t\_0}^{k}}}
\end{array}
\end{array}
Initial program 98.8%
associate-*r*98.8%
div-sub98.8%
metadata-eval98.8%
sub-neg98.8%
unpow-prod-up98.8%
pow1/298.8%
div-inv98.8%
metadata-eval98.8%
distribute-rgt-neg-in98.8%
metadata-eval98.8%
Applied egg-rr98.8%
*-commutative98.8%
associate-*l*98.8%
*-commutative98.8%
associate-*l*98.8%
Simplified98.8%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (k n) :precision binary64 (if (<= k 1.45e+22) (* (sqrt (* 2.0 (/ PI k))) (sqrt n)) (sqrt (* 2.0 (+ -1.0 (fma PI (/ n k) 1.0))))))
double code(double k, double n) {
double tmp;
if (k <= 1.45e+22) {
tmp = sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
} else {
tmp = sqrt((2.0 * (-1.0 + fma(((double) M_PI), (n / k), 1.0))));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.45e+22) tmp = Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)); else tmp = sqrt(Float64(2.0 * Float64(-1.0 + fma(pi, Float64(n / k), 1.0)))); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.45e+22], N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(-1.0 + N[(Pi * N[(n / k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.45 \cdot 10^{+22}:\\
\;\;\;\;\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(-1 + \mathsf{fma}\left(\pi, \frac{n}{k}, 1\right)\right)}\\
\end{array}
\end{array}
if k < 1.45e22Initial program 98.0%
Taylor expanded in k around 0 64.6%
*-commutative64.6%
associate-/l*64.6%
Simplified64.6%
sqrt-unprod64.8%
Applied egg-rr64.8%
*-commutative64.8%
associate-*r*64.8%
sqrt-prod92.5%
Applied egg-rr92.5%
if 1.45e22 < k Initial program 100.0%
Taylor expanded in k around 0 2.6%
*-commutative2.6%
associate-/l*2.6%
Simplified2.6%
sqrt-unprod2.6%
Applied egg-rr2.6%
expm1-log1p-u2.6%
expm1-undefine21.8%
clear-num21.8%
div-inv21.8%
Applied egg-rr21.8%
sub-neg21.8%
metadata-eval21.8%
+-commutative21.8%
log1p-undefine21.8%
rem-exp-log21.8%
+-commutative21.8%
associate-/r/21.8%
*-commutative21.8%
fma-define21.8%
Simplified21.8%
(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 98.8%
associate-*l/98.8%
*-lft-identity98.8%
associate-*l*98.8%
div-sub98.8%
metadata-eval98.8%
Simplified98.8%
div-inv98.8%
div-inv98.8%
metadata-eval98.8%
inv-pow98.8%
sqrt-pow298.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification98.8%
(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 98.8%
associate-*l/98.8%
*-lft-identity98.8%
associate-*l*98.8%
div-sub98.8%
metadata-eval98.8%
Simplified98.8%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 (/ PI k))) (sqrt n)))
double code(double k, double n) {
return sqrt((2.0 * (((double) M_PI) / k))) * sqrt(n);
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * (Math.PI / k))) * Math.sqrt(n);
}
def code(k, n): return math.sqrt((2.0 * (math.pi / k))) * math.sqrt(n)
function code(k, n) return Float64(sqrt(Float64(2.0 * Float64(pi / k))) * sqrt(n)) end
function tmp = code(k, n) tmp = sqrt((2.0 * (pi / k))) * sqrt(n); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi}{k}} \cdot \sqrt{n}
\end{array}
Initial program 98.8%
Taylor expanded in k around 0 40.6%
*-commutative40.6%
associate-/l*40.6%
Simplified40.6%
sqrt-unprod40.7%
Applied egg-rr40.7%
*-commutative40.7%
associate-*r*40.7%
sqrt-prod57.8%
Applied egg-rr57.8%
(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 98.8%
Taylor expanded in k around 0 40.6%
*-commutative40.6%
associate-/l*40.6%
Simplified40.6%
sqrt-unprod40.7%
Applied egg-rr40.7%
*-commutative40.7%
associate-*r*40.7%
*-commutative40.7%
sqrt-prod57.8%
Applied egg-rr57.8%
associate-*r/57.8%
*-commutative57.8%
associate-/l*57.7%
Simplified57.7%
(FPCore (k n) :precision binary64 (pow (/ (* k 0.5) (* PI n)) -0.5))
double code(double k, double n) {
return pow(((k * 0.5) / (((double) M_PI) * n)), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k * 0.5) / (Math.PI * n)), -0.5);
}
def code(k, n): return math.pow(((k * 0.5) / (math.pi * n)), -0.5)
function code(k, n) return Float64(Float64(k * 0.5) / Float64(pi * n)) ^ -0.5 end
function tmp = code(k, n) tmp = ((k * 0.5) / (pi * n)) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k * 0.5), $MachinePrecision] / N[(Pi * n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k \cdot 0.5}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 98.8%
associate-/r/98.7%
associate-*r*98.7%
div-sub98.7%
metadata-eval98.7%
div-inv98.7%
metadata-eval98.7%
Applied egg-rr98.7%
Taylor expanded in k around 0 41.3%
associate-*r/41.4%
*-rgt-identity41.4%
*-commutative41.4%
associate-/r*41.4%
Simplified41.4%
inv-pow41.4%
add-sqr-sqrt41.2%
sqrt-unprod41.3%
sqrt-pow241.3%
sqrt-undiv41.4%
sqrt-undiv41.4%
add-sqr-sqrt41.5%
div-inv41.5%
associate-/r*41.5%
metadata-eval41.5%
metadata-eval41.5%
Applied egg-rr41.5%
associate-*l/41.5%
*-commutative41.5%
Simplified41.5%
Final simplification41.5%
(FPCore (k n) :precision binary64 (pow (* (/ k PI) (/ 0.5 n)) -0.5))
double code(double k, double n) {
return pow(((k / ((double) M_PI)) * (0.5 / n)), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k / Math.PI) * (0.5 / n)), -0.5);
}
def code(k, n): return math.pow(((k / math.pi) * (0.5 / n)), -0.5)
function code(k, n) return Float64(Float64(k / pi) * Float64(0.5 / n)) ^ -0.5 end
function tmp = code(k, n) tmp = ((k / pi) * (0.5 / n)) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k / Pi), $MachinePrecision] * N[(0.5 / n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{\pi} \cdot \frac{0.5}{n}\right)}^{-0.5}
\end{array}
Initial program 98.8%
associate-/r/98.7%
associate-*r*98.7%
div-sub98.7%
metadata-eval98.7%
div-inv98.7%
metadata-eval98.7%
Applied egg-rr98.7%
Taylor expanded in k around 0 41.3%
associate-*r/41.4%
*-rgt-identity41.4%
*-commutative41.4%
associate-/r*41.4%
Simplified41.4%
inv-pow41.4%
add-sqr-sqrt41.2%
sqrt-unprod41.3%
sqrt-pow241.3%
sqrt-undiv41.4%
sqrt-undiv41.4%
add-sqr-sqrt41.5%
div-inv41.5%
associate-/r*41.5%
metadata-eval41.5%
metadata-eval41.5%
Applied egg-rr41.5%
associate-*l/41.5%
times-frac41.4%
Simplified41.4%
(FPCore (k n) :precision binary64 (pow (* (/ k n) (/ 0.5 PI)) -0.5))
double code(double k, double n) {
return pow(((k / n) * (0.5 / ((double) M_PI))), -0.5);
}
public static double code(double k, double n) {
return Math.pow(((k / n) * (0.5 / Math.PI)), -0.5);
}
def code(k, n): return math.pow(((k / n) * (0.5 / math.pi)), -0.5)
function code(k, n) return Float64(Float64(k / n) * Float64(0.5 / pi)) ^ -0.5 end
function tmp = code(k, n) tmp = ((k / n) * (0.5 / pi)) ^ -0.5; end
code[k_, n_] := N[Power[N[(N[(k / n), $MachinePrecision] * N[(0.5 / Pi), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{n} \cdot \frac{0.5}{\pi}\right)}^{-0.5}
\end{array}
Initial program 98.8%
Taylor expanded in k around 0 40.6%
*-commutative40.6%
associate-/l*40.6%
Simplified40.6%
sqrt-unprod40.7%
Applied egg-rr40.7%
*-commutative40.7%
associate-*r*40.7%
*-commutative40.7%
*-un-lft-identity40.7%
*-commutative40.7%
associate-*r*40.7%
*-commutative40.7%
clear-num40.7%
div-inv40.7%
Applied egg-rr40.7%
*-lft-identity40.7%
associate-/r/40.7%
Simplified40.7%
associate-/r/40.7%
associate-*r/40.7%
*-commutative40.7%
clear-num40.7%
metadata-eval40.7%
un-div-inv40.7%
metadata-eval40.7%
div-inv40.7%
clear-num40.7%
add-sqr-sqrt40.6%
frac-times40.7%
sqrt-unprod41.2%
add-sqr-sqrt41.4%
inv-pow41.4%
sqrt-pow241.4%
Applied egg-rr41.4%
(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 98.8%
Taylor expanded in k around 0 40.6%
*-commutative40.6%
associate-/l*40.6%
Simplified40.6%
sqrt-unprod40.7%
Applied egg-rr40.7%
clear-num40.7%
div-inv40.7%
Applied egg-rr40.7%
(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 98.8%
Taylor expanded in k around 0 40.6%
*-commutative40.6%
associate-/l*40.6%
Simplified40.6%
sqrt-unprod40.7%
Applied egg-rr40.7%
herbie shell --seed 2024088
(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))))