
(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 9 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 (* PI (* 2.0 n)))) (/ (sqrt t_0) (* (sqrt k) (pow t_0 (/ k 2.0))))))
double code(double k, double n) {
double t_0 = ((double) M_PI) * (2.0 * n);
return sqrt(t_0) / (sqrt(k) * pow(t_0, (k / 2.0)));
}
public static double code(double k, double n) {
double t_0 = Math.PI * (2.0 * n);
return Math.sqrt(t_0) / (Math.sqrt(k) * Math.pow(t_0, (k / 2.0)));
}
def code(k, n): t_0 = math.pi * (2.0 * n) return math.sqrt(t_0) / (math.sqrt(k) * math.pow(t_0, (k / 2.0)))
function code(k, n) t_0 = Float64(pi * Float64(2.0 * n)) return Float64(sqrt(t_0) / Float64(sqrt(k) * (t_0 ^ Float64(k / 2.0)))) end
function tmp = code(k, n) t_0 = pi * (2.0 * n); tmp = sqrt(t_0) / (sqrt(k) * (t_0 ^ (k / 2.0))); end
code[k_, n_] := Block[{t$95$0 = N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(N[Sqrt[k], $MachinePrecision] * N[Power[t$95$0, N[(k / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(2 \cdot n\right)\\
\frac{\sqrt{t\_0}}{\sqrt{k} \cdot {t\_0}^{\left(\frac{k}{2}\right)}}
\end{array}
\end{array}
Initial program 99.6%
*-commutativeN/A
un-div-invN/A
div-subN/A
metadata-evalN/A
pow-subN/A
associate-/l/N/A
/-lowering-/.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
pow-lowering-pow.f64N/A
Applied egg-rr99.7%
(FPCore (k n) :precision binary64 (if (<= k 1.75e-16) (/ (sqrt (* PI (* 2.0 n))) (sqrt k)) (* (pow (/ 4.0 (* k k)) 0.25) (pow (* PI n) 0.5))))
double code(double k, double n) {
double tmp;
if (k <= 1.75e-16) {
tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
} else {
tmp = pow((4.0 / (k * k)), 0.25) * pow((((double) M_PI) * n), 0.5);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 1.75e-16) {
tmp = Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
} else {
tmp = Math.pow((4.0 / (k * k)), 0.25) * Math.pow((Math.PI * n), 0.5);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 1.75e-16: tmp = math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k) else: tmp = math.pow((4.0 / (k * k)), 0.25) * math.pow((math.pi * n), 0.5) return tmp
function code(k, n) tmp = 0.0 if (k <= 1.75e-16) tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k)); else tmp = Float64((Float64(4.0 / Float64(k * k)) ^ 0.25) * (Float64(pi * n) ^ 0.5)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.75e-16) tmp = sqrt((pi * (2.0 * n))) / sqrt(k); else tmp = ((4.0 / (k * k)) ^ 0.25) * ((pi * n) ^ 0.5); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 1.75e-16], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(4.0 / N[(k * k), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[N[(Pi * n), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.75 \cdot 10^{-16}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k}\right)}^{0.25} \cdot {\left(\pi \cdot n\right)}^{0.5}\\
\end{array}
\end{array}
if k < 1.75000000000000009e-16Initial program 99.4%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6479.8%
Simplified79.8%
sqrt-unprodN/A
*-commutativeN/A
associate-*l/N/A
associate-*r*N/A
*-commutativeN/A
sqrt-undivN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6499.5%
Applied egg-rr99.5%
if 1.75000000000000009e-16 < k Initial program 99.8%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f644.6%
Simplified4.6%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f644.6%
Applied egg-rr4.6%
pow1/2N/A
associate-/r/N/A
unpow-prod-downN/A
metadata-evalN/A
pow-powN/A
inv-powN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
inv-powN/A
pow-powN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f644.7%
Applied egg-rr4.7%
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
frac-timesN/A
/-lowering-/.f64N/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval33.4%
Applied egg-rr33.4%
(FPCore (k n) :precision binary64 (if (<= k 4.7e+179) (/ (sqrt (* PI (* 2.0 n))) (sqrt k)) (pow (* (/ 4.0 (* k k)) (* (* PI n) (* PI n))) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = sqrt((((double) M_PI) * (2.0 * n))) / sqrt(k);
} else {
tmp = pow(((4.0 / (k * k)) * ((((double) M_PI) * n) * (((double) M_PI) * n))), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = Math.sqrt((Math.PI * (2.0 * n))) / Math.sqrt(k);
} else {
tmp = Math.pow(((4.0 / (k * k)) * ((Math.PI * n) * (Math.PI * n))), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.7e+179: tmp = math.sqrt((math.pi * (2.0 * n))) / math.sqrt(k) else: tmp = math.pow(((4.0 / (k * k)) * ((math.pi * n) * (math.pi * n))), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.7e+179) tmp = Float64(sqrt(Float64(pi * Float64(2.0 * n))) / sqrt(k)); else tmp = Float64(Float64(4.0 / Float64(k * k)) * Float64(Float64(pi * n) * Float64(pi * n))) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.7e+179) tmp = sqrt((pi * (2.0 * n))) / sqrt(k); else tmp = ((4.0 / (k * k)) * ((pi * n) * (pi * n))) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.7e+179], N[(N[Sqrt[N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(4.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * n), $MachinePrecision] * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.7 \cdot 10^{+179}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot \left(2 \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k} \cdot \left(\left(\pi \cdot n\right) \cdot \left(\pi \cdot n\right)\right)\right)}^{0.25}\\
\end{array}
\end{array}
if k < 4.70000000000000007e179Initial program 99.5%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6454.7%
Simplified54.7%
sqrt-unprodN/A
*-commutativeN/A
associate-*l/N/A
associate-*r*N/A
*-commutativeN/A
sqrt-undivN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f6467.6%
Applied egg-rr67.6%
if 4.70000000000000007e179 < k Initial program 100.0%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f642.7%
Simplified2.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.6%
Applied egg-rr2.6%
div-invN/A
clear-numN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-*r/N/A
associate-*l*N/A
*-commutativeN/A
associate-*l/N/A
unpow1/2N/A
pow-prod-downN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-downN/A
pow-prod-downN/A
Applied egg-rr30.8%
(FPCore (k n) :precision binary64 (if (<= k 4.7e+179) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (pow (* (/ 4.0 (* k k)) (* (* PI n) (* PI n))) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
} else {
tmp = pow(((4.0 / (k * k)) * ((((double) M_PI) * n) * (((double) M_PI) * n))), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
} else {
tmp = Math.pow(((4.0 / (k * k)) * ((Math.PI * n) * (Math.PI * n))), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.7e+179: tmp = math.sqrt(n) * math.sqrt((2.0 * (math.pi / k))) else: tmp = math.pow(((4.0 / (k * k)) * ((math.pi * n) * (math.pi * n))), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.7e+179) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = Float64(Float64(4.0 / Float64(k * k)) * Float64(Float64(pi * n) * Float64(pi * n))) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.7e+179) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); else tmp = ((4.0 / (k * k)) * ((pi * n) * (pi * n))) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.7e+179], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(4.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * n), $MachinePrecision] * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.7 \cdot 10^{+179}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k} \cdot \left(\left(\pi \cdot n\right) \cdot \left(\pi \cdot n\right)\right)\right)}^{0.25}\\
\end{array}
\end{array}
if k < 4.70000000000000007e179Initial program 99.5%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6454.7%
Simplified54.7%
sqrt-unprodN/A
associate-/l*N/A
associate-*l*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6467.6%
Applied egg-rr67.6%
if 4.70000000000000007e179 < k Initial program 100.0%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f642.7%
Simplified2.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.6%
Applied egg-rr2.6%
div-invN/A
clear-numN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-*r/N/A
associate-*l*N/A
*-commutativeN/A
associate-*l/N/A
unpow1/2N/A
pow-prod-downN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-downN/A
pow-prod-downN/A
Applied egg-rr30.8%
Final simplification59.0%
(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%
*-commutativeN/A
un-div-invN/A
div-subN/A
metadata-evalN/A
pow-subN/A
associate-/l/N/A
/-lowering-/.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
pow-lowering-pow.f64N/A
Applied egg-rr99.7%
div-invN/A
pow1/2N/A
metadata-evalN/A
pow-flipN/A
associate-/r*N/A
times-fracN/A
unpow-prod-upN/A
associate-*l/N/A
div-invN/A
/-lowering-/.f64N/A
Applied egg-rr99.6%
(FPCore (k n) :precision binary64 (if (<= k 4.7e+179) (pow (/ k (* PI (* 2.0 n))) -0.5) (pow (* (/ 4.0 (* k k)) (* (* PI n) (* PI n))) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = pow((k / (((double) M_PI) * (2.0 * n))), -0.5);
} else {
tmp = pow(((4.0 / (k * k)) * ((((double) M_PI) * n) * (((double) M_PI) * n))), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = Math.pow((k / (Math.PI * (2.0 * n))), -0.5);
} else {
tmp = Math.pow(((4.0 / (k * k)) * ((Math.PI * n) * (Math.PI * n))), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.7e+179: tmp = math.pow((k / (math.pi * (2.0 * n))), -0.5) else: tmp = math.pow(((4.0 / (k * k)) * ((math.pi * n) * (math.pi * n))), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.7e+179) tmp = Float64(k / Float64(pi * Float64(2.0 * n))) ^ -0.5; else tmp = Float64(Float64(4.0 / Float64(k * k)) * Float64(Float64(pi * n) * Float64(pi * n))) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.7e+179) tmp = (k / (pi * (2.0 * n))) ^ -0.5; else tmp = ((4.0 / (k * k)) * ((pi * n) * (pi * n))) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.7e+179], N[Power[N[(k / N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision], N[Power[N[(N[(4.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(Pi * n), $MachinePrecision] * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.7 \cdot 10^{+179}:\\
\;\;\;\;{\left(\frac{k}{\pi \cdot \left(2 \cdot n\right)}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k} \cdot \left(\left(\pi \cdot n\right) \cdot \left(\pi \cdot n\right)\right)\right)}^{0.25}\\
\end{array}
\end{array}
if k < 4.70000000000000007e179Initial program 99.5%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6454.7%
Simplified54.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6454.2%
Applied egg-rr54.2%
clear-numN/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
pow-lowering-pow.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6454.9%
Applied egg-rr54.9%
if 4.70000000000000007e179 < k Initial program 100.0%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f642.7%
Simplified2.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.6%
Applied egg-rr2.6%
div-invN/A
clear-numN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-*r/N/A
associate-*l*N/A
*-commutativeN/A
associate-*l/N/A
unpow1/2N/A
pow-prod-downN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-downN/A
pow-prod-downN/A
Applied egg-rr30.8%
(FPCore (k n) :precision binary64 (pow (/ k (* PI (* 2.0 n))) -0.5))
double code(double k, double n) {
return pow((k / (((double) M_PI) * (2.0 * n))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / (Math.PI * (2.0 * n))), -0.5);
}
def code(k, n): return math.pow((k / (math.pi * (2.0 * n))), -0.5)
function code(k, n) return Float64(k / Float64(pi * Float64(2.0 * n))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (pi * (2.0 * n))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[(Pi * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{\pi \cdot \left(2 \cdot n\right)}\right)}^{-0.5}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6442.5%
Simplified42.5%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6442.1%
Applied egg-rr42.1%
clear-numN/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
pow-lowering-pow.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6442.7%
Applied egg-rr42.7%
(FPCore (k n) :precision binary64 (sqrt (* (/ n k) (* PI 2.0))))
double code(double k, double n) {
return sqrt(((n / k) * (((double) M_PI) * 2.0)));
}
public static double code(double k, double n) {
return Math.sqrt(((n / k) * (Math.PI * 2.0)));
}
def code(k, n): return math.sqrt(((n / k) * (math.pi * 2.0)))
function code(k, n) return sqrt(Float64(Float64(n / k) * Float64(pi * 2.0))) end
function tmp = code(k, n) tmp = sqrt(((n / k) * (pi * 2.0))); end
code[k_, n_] := N[Sqrt[N[(N[(n / k), $MachinePrecision] * N[(Pi * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n}{k} \cdot \left(\pi \cdot 2\right)}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6442.5%
Simplified42.5%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6442.1%
Applied egg-rr42.1%
clear-numN/A
associate-/r/N/A
clear-numN/A
associate-*r/N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6442.2%
Applied egg-rr42.2%
(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(Float64(2.0 * n) * Float64(pi / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * n) * (pi / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * n), $MachinePrecision] * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot n\right) \cdot \frac{\pi}{k}}
\end{array}
Initial program 99.6%
Taylor expanded in k around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6442.5%
Simplified42.5%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6442.1%
Applied egg-rr42.1%
div-invN/A
clear-numN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6442.2%
Applied egg-rr42.2%
herbie shell --seed 2024191
(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))))