
(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 (/ (pow (* PI (* 2.0 n)) (- 0.5 (/ k 2.0))) (sqrt k)))
double code(double k, double n) {
return pow((((double) M_PI) * (2.0 * n)), (0.5 - (k / 2.0))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((Math.PI * (2.0 * n)), (0.5 - (k / 2.0))) / Math.sqrt(k);
}
def code(k, n): return math.pow((math.pi * (2.0 * n)), (0.5 - (k / 2.0))) / math.sqrt(k)
function code(k, n) return Float64((Float64(pi * Float64(2.0 * n)) ^ Float64(0.5 - Float64(k / 2.0))) / sqrt(k)) end
function tmp = code(k, n) tmp = ((pi * (2.0 * n)) ^ (0.5 - (k / 2.0))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(k / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\pi \cdot \left(2 \cdot n\right)\right)}^{\left(0.5 - \frac{k}{2}\right)}}{\sqrt{k}}
\end{array}
Initial program 99.6%
associate-*l/99.7%
*-lft-identity99.7%
sqr-pow99.5%
pow-sqr99.7%
*-commutative99.7%
associate-*l*99.7%
associate-*r/99.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
div-sub99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* n (* PI 2.0))))
(if (<= k 3.5e-42)
(/ (sqrt t_0) (sqrt k))
(sqrt (/ (pow t_0 (- 1.0 k)) k)))))
double code(double k, double n) {
double t_0 = n * (((double) M_PI) * 2.0);
double tmp;
if (k <= 3.5e-42) {
tmp = sqrt(t_0) / sqrt(k);
} else {
tmp = sqrt((pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = n * (Math.PI * 2.0);
double tmp;
if (k <= 3.5e-42) {
tmp = Math.sqrt(t_0) / Math.sqrt(k);
} else {
tmp = Math.sqrt((Math.pow(t_0, (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): t_0 = n * (math.pi * 2.0) tmp = 0 if k <= 3.5e-42: tmp = math.sqrt(t_0) / math.sqrt(k) else: tmp = math.sqrt((math.pow(t_0, (1.0 - k)) / k)) return tmp
function code(k, n) t_0 = Float64(n * Float64(pi * 2.0)) tmp = 0.0 if (k <= 3.5e-42) tmp = Float64(sqrt(t_0) / sqrt(k)); else tmp = sqrt(Float64((t_0 ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) t_0 = n * (pi * 2.0); tmp = 0.0; if (k <= 3.5e-42) tmp = sqrt(t_0) / sqrt(k); else tmp = sqrt(((t_0 ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 3.5e-42], N[(N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[k], $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 := n \cdot \left(\pi \cdot 2\right)\\
\mathbf{if}\;k \leq 3.5 \cdot 10^{-42}:\\
\;\;\;\;\frac{\sqrt{t_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{t_0}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 3.5000000000000002e-42Initial program 99.3%
Applied egg-rr46.7%
Taylor expanded in k around 0 70.8%
associate-*r*70.8%
*-commutative70.8%
associate-*l*70.8%
Simplified70.8%
sqrt-div99.5%
clear-num99.3%
*-commutative99.3%
associate-*r*99.3%
Applied egg-rr99.3%
associate-/r/99.3%
associate-*l/99.5%
*-commutative99.5%
*-rgt-identity99.5%
associate-*r*99.5%
*-commutative99.5%
Simplified99.5%
if 3.5000000000000002e-42 < k Initial program 99.8%
Applied egg-rr96.1%
Taylor expanded in k around inf 95.8%
log-pow98.7%
*-commutative98.7%
*-commutative98.7%
cancel-sign-sub-inv98.7%
metadata-eval98.7%
+-commutative98.7%
*-commutative98.7%
fma-udef98.7%
associate-*r*98.7%
exp-to-pow99.2%
*-commutative99.2%
*-commutative99.2%
associate-*l*99.2%
*-commutative99.2%
fma-udef99.2%
*-commutative99.2%
+-commutative99.2%
distribute-lft-in99.2%
Simplified99.2%
Final simplification99.3%
(FPCore (k n) :precision binary64 (if (<= k 5.2e+199) (/ (sqrt (* n (* PI 2.0))) (sqrt k)) (pow (pow (/ n (* 0.5 (/ k PI))) 2.0) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 5.2e+199) {
tmp = sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
} else {
tmp = pow(pow((n / (0.5 * (k / ((double) M_PI)))), 2.0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 5.2e+199) {
tmp = Math.sqrt((n * (Math.PI * 2.0))) / Math.sqrt(k);
} else {
tmp = Math.pow(Math.pow((n / (0.5 * (k / Math.PI))), 2.0), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 5.2e+199: tmp = math.sqrt((n * (math.pi * 2.0))) / math.sqrt(k) else: tmp = math.pow(math.pow((n / (0.5 * (k / math.pi))), 2.0), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 5.2e+199) tmp = Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)); else tmp = (Float64(n / Float64(0.5 * Float64(k / pi))) ^ 2.0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 5.2e+199) tmp = sqrt((n * (pi * 2.0))) / sqrt(k); else tmp = ((n / (0.5 * (k / pi))) ^ 2.0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 5.2e+199], N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(n / N[(0.5 * N[(k / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.2 \cdot 10^{+199}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\frac{n}{0.5 \cdot \frac{k}{\pi}}\right)}^{2}\right)}^{0.25}\\
\end{array}
\end{array}
if k < 5.2000000000000003e199Initial program 99.5%
Applied egg-rr68.2%
Taylor expanded in k around 0 46.4%
associate-*r*46.4%
*-commutative46.4%
associate-*l*46.4%
Simplified46.4%
sqrt-div61.9%
clear-num61.8%
*-commutative61.8%
associate-*r*61.8%
Applied egg-rr61.8%
associate-/r/61.8%
associate-*l/61.9%
*-commutative61.9%
*-rgt-identity61.9%
associate-*r*61.9%
*-commutative61.9%
Simplified61.9%
if 5.2000000000000003e199 < k Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in k around 0 2.8%
associate-*r*2.8%
*-commutative2.8%
associate-*l*2.8%
Simplified2.8%
*-commutative2.8%
associate-*r*2.8%
*-commutative2.8%
associate-*r/2.8%
pow1/22.8%
metadata-eval2.8%
pow-prod-up2.8%
pow-prod-down22.5%
pow222.5%
associate-*r/22.5%
*-commutative22.5%
associate-*r*22.5%
*-commutative22.5%
associate-/l*22.5%
*-un-lft-identity22.5%
times-frac22.5%
metadata-eval22.5%
Applied egg-rr22.5%
Final simplification52.2%
(FPCore (k n) :precision binary64 (if (<= k 1.9e+239) (/ (sqrt (* n (* PI 2.0))) (sqrt k)) (cbrt (pow (* 2.0 (* PI (/ n k))) 1.5))))
double code(double k, double n) {
double tmp;
if (k <= 1.9e+239) {
tmp = sqrt((n * (((double) M_PI) * 2.0))) / sqrt(k);
} else {
tmp = cbrt(pow((2.0 * (((double) M_PI) * (n / k))), 1.5));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.9e+239) {
tmp = Math.sqrt((n * (Math.PI * 2.0))) / Math.sqrt(k);
} else {
tmp = Math.cbrt(Math.pow((2.0 * (Math.PI * (n / k))), 1.5));
}
return tmp;
}
function code(k, n) tmp = 0.0 if (k <= 1.9e+239) tmp = Float64(sqrt(Float64(n * Float64(pi * 2.0))) / sqrt(k)); else tmp = cbrt((Float64(2.0 * Float64(pi * Float64(n / k))) ^ 1.5)); end return tmp end
code[k_, n_] := If[LessEqual[k, 1.9e+239], N[(N[Sqrt[N[(n * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(2.0 * N[(Pi * N[(n / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.9 \cdot 10^{+239}:\\
\;\;\;\;\frac{\sqrt{n \cdot \left(\pi \cdot 2\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(2 \cdot \left(\pi \cdot \frac{n}{k}\right)\right)}^{1.5}}\\
\end{array}
\end{array}
if k < 1.9000000000000001e239Initial program 99.5%
Applied egg-rr71.1%
Taylor expanded in k around 0 42.5%
associate-*r*42.5%
*-commutative42.5%
associate-*l*42.5%
Simplified42.5%
sqrt-div56.6%
clear-num56.5%
*-commutative56.5%
associate-*r*56.5%
Applied egg-rr56.5%
associate-/r/56.5%
associate-*l/56.6%
*-commutative56.6%
*-rgt-identity56.6%
associate-*r*56.6%
*-commutative56.6%
Simplified56.6%
if 1.9000000000000001e239 < k Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in k around 0 2.8%
associate-*r*2.8%
*-commutative2.8%
associate-*l*2.8%
Simplified2.8%
add-cbrt-cube13.6%
pow1/313.6%
Applied egg-rr13.6%
unpow1/313.6%
*-lft-identity13.6%
times-frac13.6%
metadata-eval13.6%
associate-/l*13.6%
Simplified13.6%
associate-/l*13.6%
associate-/r/13.6%
Applied egg-rr13.6%
Final simplification49.2%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* 2.0 (/ PI k)))))
double code(double k, double n) {
return sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
}
public static double code(double k, double n) {
return Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
}
def code(k, n): return math.sqrt(n) * math.sqrt((2.0 * (math.pi / k)))
function code(k, n) return Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))) end
function tmp = code(k, n) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); end
code[k_, n_] := N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.6%
Applied egg-rr76.0%
Taylor expanded in k around 0 35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*l*35.7%
Simplified35.7%
Taylor expanded in n around 0 35.7%
associate-*r/35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*r/35.7%
associate-*r*35.7%
Simplified35.7%
sqrt-prod47.3%
clear-num47.3%
un-div-inv47.3%
Applied egg-rr47.3%
associate-/l*47.3%
associate-*r/47.3%
Simplified47.3%
Final simplification47.3%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 n)) (sqrt (/ PI k))))
double code(double k, double n) {
return sqrt((2.0 * n)) * sqrt((((double) M_PI) / k));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * n)) * Math.sqrt((Math.PI / k));
}
def code(k, n): return math.sqrt((2.0 * n)) * math.sqrt((math.pi / k))
function code(k, n) return Float64(sqrt(Float64(2.0 * n)) * sqrt(Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt((2.0 * n)) * sqrt((pi / k)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(Pi / k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot n} \cdot \sqrt{\frac{\pi}{k}}
\end{array}
Initial program 99.6%
Applied egg-rr76.0%
Taylor expanded in k around 0 35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*l*35.7%
Simplified35.7%
Taylor expanded in n around 0 35.7%
associate-*r/35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*r/35.7%
associate-*r*35.7%
Simplified35.7%
pow1/235.7%
associate-*r*35.7%
unpow-prod-down47.4%
pow1/247.4%
Applied egg-rr47.4%
unpow1/247.4%
Simplified47.4%
Final simplification47.4%
(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.6%
Applied egg-rr76.0%
Taylor expanded in k around 0 35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*l*35.7%
Simplified35.7%
sqrt-div47.4%
clear-num47.3%
*-commutative47.3%
associate-*r*47.3%
Applied egg-rr47.3%
associate-/r/47.3%
associate-*l/47.4%
*-commutative47.4%
*-rgt-identity47.4%
associate-*r*47.4%
*-commutative47.4%
Simplified47.4%
Final simplification47.4%
(FPCore (k n) :precision binary64 (pow (* 0.5 (/ k (* PI n))) -0.5))
double code(double k, double n) {
return pow((0.5 * (k / (((double) M_PI) * n))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((0.5 * (k / (Math.PI * n))), -0.5);
}
def code(k, n): return math.pow((0.5 * (k / (math.pi * n))), -0.5)
function code(k, n) return Float64(0.5 * Float64(k / Float64(pi * n))) ^ -0.5 end
function tmp = code(k, n) tmp = (0.5 * (k / (pi * n))) ^ -0.5; end
code[k_, n_] := N[Power[N[(0.5 * N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(0.5 \cdot \frac{k}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.6%
Applied egg-rr76.0%
Taylor expanded in k around 0 35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*l*35.7%
Simplified35.7%
Taylor expanded in n around 0 35.7%
associate-*r/35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*r/35.7%
associate-*r*35.7%
Simplified35.7%
*-commutative35.7%
associate-*r*35.7%
clear-num35.7%
div-inv35.7%
associate-/l*35.7%
associate-/l*35.7%
associate-*l/35.7%
associate-/l*35.7%
associate-*r*35.7%
clear-num35.7%
metadata-eval35.7%
add-sqr-sqrt35.6%
frac-times35.6%
sqrt-unprod36.3%
add-sqr-sqrt36.4%
inv-pow36.4%
sqrt-pow236.5%
Applied egg-rr36.5%
Final simplification36.5%
(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(k * Float64(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[(k * N[(0.5 / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{0.5}{\pi \cdot n}\right)}^{-0.5}
\end{array}
Initial program 99.6%
Applied egg-rr76.0%
Taylor expanded in k around 0 35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*l*35.7%
Simplified35.7%
Taylor expanded in n around 0 35.7%
associate-*r/35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*r/35.7%
associate-*r*35.7%
Simplified35.7%
*-commutative35.7%
associate-*r*35.7%
clear-num35.7%
div-inv35.7%
associate-/l*35.7%
associate-/l*35.7%
associate-*l/35.7%
associate-/l*35.7%
associate-*r*35.7%
clear-num35.7%
metadata-eval35.7%
add-sqr-sqrt35.6%
frac-times35.6%
sqrt-unprod36.3%
add-sqr-sqrt36.4%
inv-pow36.4%
sqrt-pow236.5%
Applied egg-rr36.5%
associate-*r/36.5%
associate-*l/36.5%
*-commutative36.5%
Simplified36.5%
Final simplification36.5%
(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%
Applied egg-rr76.0%
Taylor expanded in k around 0 35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*l*35.7%
Simplified35.7%
Taylor expanded in n around 0 35.7%
associate-*r/35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*r/35.7%
associate-*r*35.7%
Simplified35.7%
Final simplification35.7%
(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%
Applied egg-rr76.0%
Taylor expanded in k around 0 35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*l*35.7%
Simplified35.7%
*-commutative35.7%
associate-*r*35.7%
*-commutative35.7%
associate-*r/35.7%
*-commutative35.7%
associate-/l*35.7%
Applied egg-rr35.7%
Final simplification35.7%
herbie shell --seed 2024018
(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))))