
(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 (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 99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
pow-div99.6%
pow1/299.6%
associate-*r/99.7%
pow1/299.7%
pow-flip99.7%
metadata-eval99.7%
div-inv99.7%
metadata-eval99.7%
Applied egg-rr99.7%
(FPCore (k n) :precision binary64 (/ (pow k -0.5) (pow (* n (* 2.0 PI)) (- (fma k -0.5 0.5)))))
double code(double k, double n) {
return pow(k, -0.5) / pow((n * (2.0 * ((double) M_PI))), -fma(k, -0.5, 0.5));
}
function code(k, n) return Float64((k ^ -0.5) / (Float64(n * Float64(2.0 * pi)) ^ Float64(-fma(k, -0.5, 0.5)))) end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] / N[Power[N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], (-N[(k * -0.5 + 0.5), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{k}^{-0.5}}{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(-\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}}
\end{array}
Initial program 99.5%
associate-/r/99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
sub-neg99.5%
div-inv99.5%
metadata-eval99.5%
distribute-rgt-neg-in99.5%
metadata-eval99.5%
Applied egg-rr99.5%
inv-pow99.5%
div-inv99.5%
unpow-prod-down99.5%
inv-pow99.5%
pow1/299.5%
pow-flip99.5%
metadata-eval99.5%
pow-flip99.5%
*-commutative99.5%
*-commutative99.5%
associate-*r*99.5%
+-commutative99.5%
fma-define99.5%
Applied egg-rr99.5%
*-commutative99.5%
unpow-199.5%
associate-*l/99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 1.2e-125) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (sqrt (/ (pow (* 2.0 (* PI n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 1.2e-125) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} else {
tmp = sqrt((pow((2.0 * (((double) M_PI) * n)), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.2e-125) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} else {
tmp = Math.sqrt((Math.pow((2.0 * (Math.PI * n)), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.2e-125: tmp = math.sqrt((2.0 * n)) / math.sqrt((k / math.pi)) else: tmp = math.sqrt((math.pow((2.0 * (math.pi * n)), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.2e-125) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = sqrt(Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.2e-125) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); else tmp = sqrt((((2.0 * (pi * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.2e-125], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.2 \cdot 10^{-125}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 1.2000000000000001e-125Initial program 99.3%
Taylor expanded in k around 0 68.6%
associate-/l*68.5%
Simplified68.5%
*-commutative68.5%
pow1/268.5%
pow1/268.5%
pow-prod-down68.8%
Applied egg-rr68.8%
associate-*r*68.8%
clear-num68.8%
un-div-inv68.8%
Applied egg-rr68.8%
unpow1/268.8%
sqrt-div99.4%
*-commutative99.4%
Applied egg-rr99.4%
if 1.2000000000000001e-125 < k Initial program 99.6%
Applied egg-rr99.7%
*-commutative99.7%
distribute-lft-in99.7%
metadata-eval99.7%
*-commutative99.7%
associate-*r*99.7%
metadata-eval99.7%
neg-mul-199.7%
sub-neg99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 3.45e+205) (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))) (pow (pow (/ (/ k n) (* 2.0 PI)) -2.0) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 3.45e+205) {
tmp = sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
} else {
tmp = pow(pow(((k / n) / (2.0 * ((double) M_PI))), -2.0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3.45e+205) {
tmp = Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
} else {
tmp = Math.pow(Math.pow(((k / n) / (2.0 * Math.PI)), -2.0), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 3.45e+205: tmp = math.sqrt((2.0 * n)) / math.sqrt((k / math.pi)) else: tmp = math.pow(math.pow(((k / n) / (2.0 * math.pi)), -2.0), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 3.45e+205) tmp = Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))); else tmp = (Float64(Float64(k / n) / Float64(2.0 * pi)) ^ -2.0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 3.45e+205) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); else tmp = (((k / n) / (2.0 * pi)) ^ -2.0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 3.45e+205], N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Power[N[(N[(k / n), $MachinePrecision] / N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.45 \cdot 10^{+205}:\\
\;\;\;\;\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(\frac{\frac{k}{n}}{2 \cdot \pi}\right)}^{-2}\right)}^{0.25}\\
\end{array}
\end{array}
if k < 3.4499999999999999e205Initial program 99.4%
Taylor expanded in k around 0 46.2%
associate-/l*46.2%
Simplified46.2%
*-commutative46.2%
pow1/246.2%
pow1/246.2%
pow-prod-down46.3%
Applied egg-rr46.3%
associate-*r*46.3%
clear-num46.2%
un-div-inv46.3%
Applied egg-rr46.3%
unpow1/246.3%
sqrt-div57.4%
*-commutative57.4%
Applied egg-rr57.4%
if 3.4499999999999999e205 < k Initial program 100.0%
Taylor expanded in k around 0 2.8%
associate-/l*2.8%
Simplified2.8%
*-commutative2.8%
pow1/22.8%
pow1/22.8%
pow-prod-down2.8%
Applied egg-rr2.8%
metadata-eval2.8%
associate-*r/2.8%
*-commutative2.8%
times-frac2.8%
*-commutative2.8%
*-commutative2.8%
associate-*r*2.8%
*-un-lft-identity2.8%
pow1/22.8%
sqrt-undiv3.0%
frac-2neg3.0%
Applied egg-rr3.0%
add-sqr-sqrt3.0%
sqrt-unprod2.8%
frac-times2.8%
sqr-neg2.8%
add-sqr-sqrt2.8%
sqr-neg2.8%
add-sqr-sqrt2.8%
clear-num2.8%
unpow1/22.8%
sqr-pow2.8%
pow-prod-down15.1%
Applied egg-rr15.1%
Final simplification51.0%
(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.5%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
metadata-eval99.5%
div-sub99.5%
associate-*r*99.5%
div-inv99.5%
associate-*r*99.5%
div-sub99.5%
metadata-eval99.5%
sub-neg99.5%
div-inv99.5%
metadata-eval99.5%
distribute-rgt-neg-in99.5%
metadata-eval99.5%
pow1/299.5%
pow-flip99.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.5%
associate-*l/99.5%
*-lft-identity99.5%
associate-*l*99.5%
div-sub99.5%
metadata-eval99.5%
Simplified99.5%
(FPCore (k n) :precision binary64 (/ (sqrt (* 2.0 n)) (sqrt (/ k PI))))
double code(double k, double n) {
return sqrt((2.0 * n)) / sqrt((k / ((double) M_PI)));
}
public static double code(double k, double n) {
return Math.sqrt((2.0 * n)) / Math.sqrt((k / Math.PI));
}
def code(k, n): return math.sqrt((2.0 * n)) / math.sqrt((k / math.pi))
function code(k, n) return Float64(sqrt(Float64(2.0 * n)) / sqrt(Float64(k / pi))) end
function tmp = code(k, n) tmp = sqrt((2.0 * n)) / sqrt((k / pi)); end
code[k_, n_] := N[(N[Sqrt[N[(2.0 * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{2 \cdot n}}{\sqrt{\frac{k}{\pi}}}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.6%
associate-/l*39.6%
Simplified39.6%
*-commutative39.6%
pow1/239.6%
pow1/239.6%
pow-prod-down39.7%
Applied egg-rr39.7%
associate-*r*39.7%
clear-num39.6%
un-div-inv39.7%
Applied egg-rr39.7%
unpow1/239.7%
sqrt-div49.1%
*-commutative49.1%
Applied egg-rr49.1%
Final simplification49.1%
(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.5%
Taylor expanded in k around 0 39.6%
associate-/l*39.6%
Simplified39.6%
*-commutative39.6%
pow1/239.6%
pow1/239.6%
pow-prod-down39.7%
Applied egg-rr39.7%
associate-*r*39.7%
clear-num39.6%
un-div-inv39.7%
Applied egg-rr39.7%
div-inv39.6%
unpow-prod-down49.1%
pow1/249.1%
*-commutative49.1%
clear-num49.1%
Applied egg-rr49.1%
unpow1/249.1%
Simplified49.1%
Final simplification49.1%
(FPCore (k n) :precision binary64 (pow (/ k (* n (* 2.0 PI))) -0.5))
double code(double k, double n) {
return pow((k / (n * (2.0 * ((double) M_PI)))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / (n * (2.0 * Math.PI))), -0.5);
}
def code(k, n): return math.pow((k / (n * (2.0 * math.pi))), -0.5)
function code(k, n) return Float64(k / Float64(n * Float64(2.0 * pi))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (n * (2.0 * pi))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{n \cdot \left(2 \cdot \pi\right)}\right)}^{-0.5}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.6%
associate-/l*39.6%
Simplified39.6%
*-commutative39.6%
pow1/239.6%
pow1/239.6%
pow-prod-down39.7%
Applied egg-rr39.7%
metadata-eval39.7%
associate-*r/39.6%
*-commutative39.6%
times-frac39.6%
*-un-lft-identity39.6%
clear-num39.6%
*-commutative39.6%
*-commutative39.6%
associate-*r*39.6%
Applied egg-rr39.6%
sqr-pow39.4%
inv-pow39.4%
pow-pow39.5%
associate-/r*39.5%
metadata-eval39.5%
metadata-eval39.5%
inv-pow39.5%
pow-pow39.9%
associate-/r*39.9%
metadata-eval39.9%
metadata-eval39.9%
Applied egg-rr39.9%
pow-sqr40.1%
metadata-eval40.1%
associate-/r*40.1%
Simplified40.1%
Final simplification40.1%
(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(Float64(0.5 / 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[(N[(0.5 / Pi), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(k \cdot \frac{\frac{0.5}{\pi}}{n}\right)}^{-0.5}
\end{array}
Initial program 99.5%
Taylor expanded in k around 0 39.6%
associate-/l*39.6%
Simplified39.6%
*-commutative39.6%
pow1/239.6%
pow1/239.6%
pow-prod-down39.7%
Applied egg-rr39.7%
metadata-eval39.7%
associate-*r/39.6%
*-commutative39.6%
times-frac39.6%
*-un-lft-identity39.6%
clear-num39.6%
*-commutative39.6%
*-commutative39.6%
associate-*r*39.6%
Applied egg-rr39.6%
sqr-pow39.4%
inv-pow39.4%
pow-pow39.5%
associate-/r*39.5%
metadata-eval39.5%
metadata-eval39.5%
inv-pow39.5%
pow-pow39.9%
associate-/r*39.9%
metadata-eval39.9%
metadata-eval39.9%
Applied egg-rr39.9%
pow-sqr40.1%
metadata-eval40.1%
*-rgt-identity40.1%
associate-*r/40.0%
associate-*l/40.0%
associate-/l*40.0%
*-commutative40.0%
associate-/r*40.0%
metadata-eval40.0%
Simplified40.0%
(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.5%
Taylor expanded in k around 0 39.6%
associate-/l*39.6%
Simplified39.6%
*-commutative39.6%
pow1/239.6%
pow1/239.6%
pow-prod-down39.7%
Applied egg-rr39.7%
associate-*r*39.7%
clear-num39.6%
un-div-inv39.7%
Applied egg-rr39.7%
unpow1/239.7%
associate-/l*39.7%
div-inv39.6%
clear-num39.7%
Applied egg-rr39.7%
herbie shell --seed 2024151
(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))))