
(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 t_0 0.5) (pow (* k (pow t_0 k)) 0.5))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return pow(t_0, 0.5) / pow((k * 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(t_0, 0.5) / Math.pow((k * Math.pow(t_0, k)), 0.5);
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return math.pow(t_0, 0.5) / math.pow((k * math.pow(t_0, k)), 0.5)
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64((t_0 ^ 0.5) / (Float64(k * (t_0 ^ k)) ^ 0.5)) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = (t_0 ^ 0.5) / ((k * (t_0 ^ k)) ^ 0.5); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[Power[t$95$0, 0.5], $MachinePrecision] / N[Power[N[(k * N[Power[t$95$0, k], $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{{t\_0}^{0.5}}{{\left(k \cdot {t\_0}^{k}\right)}^{0.5}}
\end{array}
\end{array}
Initial program 99.5%
associate-*r*N/A
div-subN/A
metadata-evalN/A
*-commutativeN/A
pow-subN/A
frac-timesN/A
*-rgt-identityN/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 5e-46) (/ (sqrt (* 2.0 (* PI 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 <= 5e-46) {
tmp = sqrt((2.0 * (((double) M_PI) * 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 <= 5e-46) {
tmp = Math.sqrt((2.0 * (Math.PI * 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 <= 5e-46: tmp = math.sqrt((2.0 * (math.pi * 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 <= 5e-46) tmp = Float64(sqrt(Float64(2.0 * Float64(pi * 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 <= 5e-46) tmp = sqrt((2.0 * (pi * 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, 5e-46], N[(N[Sqrt[N[(2.0 * N[(Pi * 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 5 \cdot 10^{-46}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\pi \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 < 4.99999999999999992e-46Initial program 99.3%
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.f6476.0%
Simplified76.0%
sqrt-unprodN/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
sqrt-divN/A
unpow1/2N/A
/-lowering-/.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6499.5%
Applied egg-rr99.5%
if 4.99999999999999992e-46 < k Initial program 99.7%
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.f6413.2%
Simplified13.2%
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.f6413.2%
Applied egg-rr13.2%
pow1/2N/A
associate-/r/N/A
unpow-prod-downN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6413.3%
Applied egg-rr13.3%
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
frac-timesN/A
/-lowering-/.f64N/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval31.6%
Applied egg-rr31.6%
(FPCore (k n) :precision binary64 (if (<= k 2.25e+154) (/ (sqrt (* 2.0 (* PI n))) (sqrt k)) (pow (* (/ 4.0 (* k k)) (* PI (* n (* PI n)))) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 2.25e+154) {
tmp = sqrt((2.0 * (((double) M_PI) * 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 <= 2.25e+154) {
tmp = Math.sqrt((2.0 * (Math.PI * 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 <= 2.25e+154: tmp = math.sqrt((2.0 * (math.pi * 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 <= 2.25e+154) tmp = Float64(sqrt(Float64(2.0 * Float64(pi * n))) / sqrt(k)); else tmp = Float64(Float64(4.0 / Float64(k * k)) * Float64(pi * Float64(n * Float64(pi * n)))) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.25e+154) tmp = sqrt((2.0 * (pi * 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, 2.25e+154], N[(N[Sqrt[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(4.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(n * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.25 \cdot 10^{+154}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k} \cdot \left(\pi \cdot \left(n \cdot \left(\pi \cdot n\right)\right)\right)\right)}^{0.25}\\
\end{array}
\end{array}
if k < 2.25000000000000005e154Initial 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.f6449.5%
Simplified49.5%
sqrt-unprodN/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
sqrt-divN/A
unpow1/2N/A
/-lowering-/.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6461.9%
Applied egg-rr61.9%
if 2.25000000000000005e154 < 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.6%
Simplified2.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.f642.6%
Applied egg-rr2.6%
pow1/2N/A
associate-/r/N/A
unpow-prod-downN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
sqr-powN/A
pow-prod-downN/A
sqr-powN/A
pow-prod-downN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
frac-timesN/A
/-lowering-/.f64N/A
metadata-evalN/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
metadata-eval24.5%
Applied egg-rr24.5%
(FPCore (k n) :precision binary64 (if (<= k 2.25e+154) (* (sqrt (/ 2.0 (/ k PI))) (sqrt n)) (pow (* (/ 4.0 (* k k)) (* PI (* n (* PI n)))) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 2.25e+154) {
tmp = sqrt((2.0 / (k / ((double) M_PI)))) * sqrt(n);
} 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 <= 2.25e+154) {
tmp = Math.sqrt((2.0 / (k / Math.PI))) * Math.sqrt(n);
} 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 <= 2.25e+154: tmp = math.sqrt((2.0 / (k / math.pi))) * math.sqrt(n) 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 <= 2.25e+154) tmp = Float64(sqrt(Float64(2.0 / Float64(k / pi))) * sqrt(n)); else tmp = Float64(Float64(4.0 / Float64(k * k)) * Float64(pi * Float64(n * Float64(pi * n)))) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.25e+154) tmp = sqrt((2.0 / (k / pi))) * sqrt(n); else tmp = ((4.0 / (k * k)) * (pi * (n * (pi * n)))) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.25e+154], N[(N[Sqrt[N[(2.0 / N[(k / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(4.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(n * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.25 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{k}{\pi}}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k} \cdot \left(\pi \cdot \left(n \cdot \left(\pi \cdot n\right)\right)\right)\right)}^{0.25}\\
\end{array}
\end{array}
if k < 2.25000000000000005e154Initial 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.f6449.5%
Simplified49.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.f6449.6%
Applied egg-rr49.6%
associate-/r/N/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f6461.9%
Applied egg-rr61.9%
if 2.25000000000000005e154 < 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.6%
Simplified2.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.f642.6%
Applied egg-rr2.6%
pow1/2N/A
associate-/r/N/A
unpow-prod-downN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
sqr-powN/A
pow-prod-downN/A
sqr-powN/A
pow-prod-downN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
frac-timesN/A
/-lowering-/.f64N/A
metadata-evalN/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
metadata-eval24.5%
Applied egg-rr24.5%
(FPCore (k n) :precision binary64 (if (<= k 2.25e+154) (* (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 <= 2.25e+154) {
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 <= 2.25e+154) {
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 <= 2.25e+154: 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 <= 2.25e+154) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = Float64(Float64(4.0 / Float64(k * k)) * Float64(pi * Float64(n * Float64(pi * n)))) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.25e+154) 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, 2.25e+154], 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[(Pi * N[(n * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.25 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k} \cdot \left(\pi \cdot \left(n \cdot \left(\pi \cdot n\right)\right)\right)\right)}^{0.25}\\
\end{array}
\end{array}
if k < 2.25000000000000005e154Initial 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.f6449.5%
Simplified49.5%
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.f6461.9%
Applied egg-rr61.9%
if 2.25000000000000005e154 < 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.6%
Simplified2.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.f642.6%
Applied egg-rr2.6%
pow1/2N/A
associate-/r/N/A
unpow-prod-downN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
sqr-powN/A
pow-prod-downN/A
sqr-powN/A
pow-prod-downN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
frac-timesN/A
/-lowering-/.f64N/A
metadata-evalN/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
metadata-eval24.5%
Applied egg-rr24.5%
Final simplification53.3%
(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/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
div-subN/A
--lowering--.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
(FPCore (k n) :precision binary64 (if (<= k 1.35e+154) (pow (/ k (* n (* 2.0 PI))) -0.5) (pow (* (/ 4.0 (* k k)) (* PI (* n (* PI n)))) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 1.35e+154) {
tmp = pow((k / (n * (2.0 * ((double) M_PI)))), -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 <= 1.35e+154) {
tmp = Math.pow((k / (n * (2.0 * Math.PI))), -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 <= 1.35e+154: tmp = math.pow((k / (n * (2.0 * math.pi))), -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 <= 1.35e+154) tmp = Float64(k / Float64(n * Float64(2.0 * pi))) ^ -0.5; else tmp = Float64(Float64(4.0 / Float64(k * k)) * Float64(pi * Float64(n * Float64(pi * n)))) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 1.35e+154) tmp = (k / (n * (2.0 * pi))) ^ -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, 1.35e+154], N[Power[N[(k / N[(n * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision], N[Power[N[(N[(4.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(Pi * N[(n * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;{\left(\frac{k}{n \cdot \left(2 \cdot \pi\right)}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{4}{k \cdot k} \cdot \left(\pi \cdot \left(n \cdot \left(\pi \cdot n\right)\right)\right)\right)}^{0.25}\\
\end{array}
\end{array}
if k < 1.35000000000000003e154Initial 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.f6449.8%
Simplified49.8%
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.f6449.9%
Applied egg-rr49.9%
clear-numN/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
metadata-eval50.1%
Applied egg-rr50.1%
if 1.35000000000000003e154 < 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.5%
Simplified2.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.f642.5%
Applied egg-rr2.5%
pow1/2N/A
associate-/r/N/A
unpow-prod-downN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
sqr-powN/A
pow-prod-downN/A
sqr-powN/A
pow-prod-downN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
frac-timesN/A
/-lowering-/.f64N/A
metadata-evalN/A
*-lowering-*.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
metadata-eval24.1%
Applied egg-rr24.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
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6438.7%
Simplified38.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.f6438.8%
Applied egg-rr38.8%
clear-numN/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
associate-/l/N/A
/-lowering-/.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
metadata-eval39.0%
Applied egg-rr39.0%
(FPCore (k n) :precision binary64 (sqrt (* (* 2.0 PI) (/ n k))))
double code(double k, double n) {
return sqrt(((2.0 * ((double) M_PI)) * (n / k)));
}
public static double code(double k, double n) {
return Math.sqrt(((2.0 * Math.PI) * (n / k)));
}
def code(k, n): return math.sqrt(((2.0 * math.pi) * (n / k)))
function code(k, n) return sqrt(Float64(Float64(2.0 * pi) * Float64(n / k))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * pi) * (n / k))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * Pi), $MachinePrecision] * N[(n / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot \pi\right) \cdot \frac{n}{k}}
\end{array}
Initial 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.f6438.7%
Simplified38.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.f6438.8%
Applied egg-rr38.8%
div-invN/A
clear-numN/A
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6438.9%
Applied egg-rr38.9%
Final simplification38.9%
(FPCore (k n) :precision binary64 (sqrt (* n (/ 2.0 (/ k PI)))))
double code(double k, double n) {
return sqrt((n * (2.0 / (k / ((double) M_PI)))));
}
public static double code(double k, double n) {
return Math.sqrt((n * (2.0 / (k / Math.PI))));
}
def code(k, n): return math.sqrt((n * (2.0 / (k / math.pi))))
function code(k, n) return sqrt(Float64(n * Float64(2.0 / Float64(k / pi)))) end
function tmp = code(k, n) tmp = sqrt((n * (2.0 / (k / pi)))); end
code[k_, n_] := N[Sqrt[N[(n * N[(2.0 / N[(k / Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \frac{2}{\frac{k}{\pi}}}
\end{array}
Initial 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.f6438.7%
Simplified38.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.f6438.8%
Applied egg-rr38.8%
associate-/r/N/A
associate-*r*N/A
*-lowering-*.f64N/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6438.8%
Applied egg-rr38.8%
Final simplification38.8%
(FPCore (k n) :precision binary64 (sqrt (* (* PI n) (/ 2.0 k))))
double code(double k, double n) {
return sqrt(((((double) M_PI) * n) * (2.0 / k)));
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI * n) * (2.0 / k)));
}
def code(k, n): return math.sqrt(((math.pi * n) * (2.0 / k)))
function code(k, n) return sqrt(Float64(Float64(pi * n) * Float64(2.0 / k))) end
function tmp = code(k, n) tmp = sqrt(((pi * n) * (2.0 / k))); end
code[k_, n_] := N[Sqrt[N[(N[(Pi * n), $MachinePrecision] * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(\pi \cdot n\right) \cdot \frac{2}{k}}
\end{array}
Initial 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.f6438.7%
Simplified38.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.f6438.8%
Applied egg-rr38.8%
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6438.8%
Applied egg-rr38.8%
Final simplification38.8%
herbie shell --seed 2024152
(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))))