
(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 10 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 9.8e-28) (/ (sqrt (* PI n)) (sqrt (/ k 2.0))) (sqrt (/ (pow (* 2.0 (* PI n)) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 9.8e-28) {
tmp = sqrt((((double) M_PI) * n)) / sqrt((k / 2.0));
} 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 <= 9.8e-28) {
tmp = Math.sqrt((Math.PI * n)) / Math.sqrt((k / 2.0));
} 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 <= 9.8e-28: tmp = math.sqrt((math.pi * n)) / math.sqrt((k / 2.0)) 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 <= 9.8e-28) tmp = Float64(sqrt(Float64(pi * n)) / sqrt(Float64(k / 2.0))); 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 <= 9.8e-28) tmp = sqrt((pi * n)) / sqrt((k / 2.0)); else tmp = sqrt((((2.0 * (pi * n)) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 9.8e-28], N[(N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / 2.0), $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 9.8 \cdot 10^{-28}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot n}}{\sqrt{\frac{k}{2}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 9.80000000000000059e-28Initial 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.f6471.4%
Simplified71.4%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6471.6%
Applied egg-rr71.6%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6471.6%
Applied egg-rr71.6%
*-commutativeN/A
associate-*r*N/A
clear-numN/A
un-div-invN/A
associate-*l/N/A
sqrt-divN/A
pow1/2N/A
/-lowering-/.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6499.5%
Applied egg-rr99.5%
if 9.80000000000000059e-28 < k Initial program 99.7%
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.7%
Simplified99.7%
metadata-evalN/A
div-subN/A
frac-2negN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow-unpowN/A
pow-lowering-pow.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in n around 0
Simplified99.7%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow k -0.5) (pow (* 2.0 (* PI n)) (+ -0.5 (/ k 2.0)))))
double code(double k, double n) {
return pow(k, -0.5) / pow((2.0 * (((double) M_PI) * n)), (-0.5 + (k / 2.0)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) / Math.pow((2.0 * (Math.PI * n)), (-0.5 + (k / 2.0)));
}
def code(k, n): return math.pow(k, -0.5) / math.pow((2.0 * (math.pi * n)), (-0.5 + (k / 2.0)))
function code(k, n) return Float64((k ^ -0.5) / (Float64(2.0 * Float64(pi * n)) ^ Float64(-0.5 + Float64(k / 2.0)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) / ((2.0 * (pi * n)) ^ (-0.5 + (k / 2.0))); 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 / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{k}^{-0.5}}{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(-0.5 + \frac{k}{2}\right)}}
\end{array}
Initial program 99.6%
associate-*r*N/A
div-subN/A
metadata-evalN/A
pow-subN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
inv-powN/A
pow1/2N/A
pow-powN/A
pow-lowering-pow.f64N/A
metadata-evalN/A
clear-numN/A
pow-subN/A
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (+ 0.5 (/ k -2.0)))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), (0.5 + (k / -2.0)));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), (0.5 + (k / -2.0)));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), (0.5 + (k / -2.0)))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(0.5 + Float64(k / -2.0)))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ (0.5 + (k / -2.0))); 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 / -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(0.5 + \frac{k}{-2}\right)}
\end{array}
Initial program 99.6%
*-commutativeN/A
associate-*r*N/A
div-subN/A
metadata-evalN/A
*-lowering-*.f64N/A
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 1.1e+242)
(/ (sqrt (* PI n)) (sqrt (/ k 2.0)))
(pow (* t_0 t_0) 0.25))))
double code(double k, double n) {
double t_0 = 2.0 / (k / (((double) M_PI) * n));
double tmp;
if (k <= 1.1e+242) {
tmp = sqrt((((double) M_PI) * n)) / sqrt((k / 2.0));
} else {
tmp = pow((t_0 * t_0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = 2.0 / (k / (Math.PI * n));
double tmp;
if (k <= 1.1e+242) {
tmp = Math.sqrt((Math.PI * n)) / Math.sqrt((k / 2.0));
} else {
tmp = Math.pow((t_0 * t_0), 0.25);
}
return tmp;
}
def code(k, n): t_0 = 2.0 / (k / (math.pi * n)) tmp = 0 if k <= 1.1e+242: tmp = math.sqrt((math.pi * n)) / math.sqrt((k / 2.0)) else: tmp = math.pow((t_0 * t_0), 0.25) return tmp
function code(k, n) t_0 = Float64(2.0 / Float64(k / Float64(pi * n))) tmp = 0.0 if (k <= 1.1e+242) tmp = Float64(sqrt(Float64(pi * n)) / sqrt(Float64(k / 2.0))); else tmp = Float64(t_0 * t_0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) t_0 = 2.0 / (k / (pi * n)); tmp = 0.0; if (k <= 1.1e+242) tmp = sqrt((pi * n)) / sqrt((k / 2.0)); else tmp = (t_0 * t_0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(2.0 / N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.1e+242], N[(N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(k / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 0.25], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.1 \cdot 10^{+242}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot n}}{\sqrt{\frac{k}{2}}}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 1.1e242Initial 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.f6435.9%
Simplified35.9%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6436.0%
Applied egg-rr36.0%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6436.0%
Applied egg-rr36.0%
*-commutativeN/A
associate-*r*N/A
clear-numN/A
un-div-invN/A
associate-*l/N/A
sqrt-divN/A
pow1/2N/A
/-lowering-/.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6448.0%
Applied egg-rr48.0%
if 1.1e242 < 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
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
pow1/2N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr23.5%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 4.5e+241)
(/ (sqrt (* 2.0 (* PI n))) (sqrt k))
(pow (* t_0 t_0) 0.25))))
double code(double k, double n) {
double t_0 = 2.0 / (k / (((double) M_PI) * n));
double tmp;
if (k <= 4.5e+241) {
tmp = sqrt((2.0 * (((double) M_PI) * n))) / sqrt(k);
} else {
tmp = pow((t_0 * t_0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = 2.0 / (k / (Math.PI * n));
double tmp;
if (k <= 4.5e+241) {
tmp = Math.sqrt((2.0 * (Math.PI * n))) / Math.sqrt(k);
} else {
tmp = Math.pow((t_0 * t_0), 0.25);
}
return tmp;
}
def code(k, n): t_0 = 2.0 / (k / (math.pi * n)) tmp = 0 if k <= 4.5e+241: tmp = math.sqrt((2.0 * (math.pi * n))) / math.sqrt(k) else: tmp = math.pow((t_0 * t_0), 0.25) return tmp
function code(k, n) t_0 = Float64(2.0 / Float64(k / Float64(pi * n))) tmp = 0.0 if (k <= 4.5e+241) tmp = Float64(sqrt(Float64(2.0 * Float64(pi * n))) / sqrt(k)); else tmp = Float64(t_0 * t_0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) t_0 = 2.0 / (k / (pi * n)); tmp = 0.0; if (k <= 4.5e+241) tmp = sqrt((2.0 * (pi * n))) / sqrt(k); else tmp = (t_0 * t_0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(2.0 / N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 4.5e+241], N[(N[Sqrt[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 0.25], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 4.5 \cdot 10^{+241}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 4.49999999999999993e241Initial 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.f6436.0%
Simplified36.0%
sqrt-unprodN/A
associate-*l/N/A
*-commutativeN/A
*-commutativeN/A
sqrt-divN/A
unpow1/2N/A
/-lowering-/.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f6448.1%
Applied egg-rr48.1%
if 4.49999999999999993e241 < 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
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
pow1/2N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr22.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 1.15e+242)
(* (sqrt (/ 2.0 (/ k PI))) (sqrt n))
(pow (* t_0 t_0) 0.25))))
double code(double k, double n) {
double t_0 = 2.0 / (k / (((double) M_PI) * n));
double tmp;
if (k <= 1.15e+242) {
tmp = sqrt((2.0 / (k / ((double) M_PI)))) * sqrt(n);
} else {
tmp = pow((t_0 * t_0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = 2.0 / (k / (Math.PI * n));
double tmp;
if (k <= 1.15e+242) {
tmp = Math.sqrt((2.0 / (k / Math.PI))) * Math.sqrt(n);
} else {
tmp = Math.pow((t_0 * t_0), 0.25);
}
return tmp;
}
def code(k, n): t_0 = 2.0 / (k / (math.pi * n)) tmp = 0 if k <= 1.15e+242: tmp = math.sqrt((2.0 / (k / math.pi))) * math.sqrt(n) else: tmp = math.pow((t_0 * t_0), 0.25) return tmp
function code(k, n) t_0 = Float64(2.0 / Float64(k / Float64(pi * n))) tmp = 0.0 if (k <= 1.15e+242) tmp = Float64(sqrt(Float64(2.0 / Float64(k / pi))) * sqrt(n)); else tmp = Float64(t_0 * t_0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) t_0 = 2.0 / (k / (pi * n)); tmp = 0.0; if (k <= 1.15e+242) tmp = sqrt((2.0 / (k / pi))) * sqrt(n); else tmp = (t_0 * t_0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(2.0 / N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.15e+242], N[(N[Sqrt[N[(2.0 / N[(k / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[n], $MachinePrecision]), $MachinePrecision], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 0.25], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.15 \cdot 10^{+242}:\\
\;\;\;\;\sqrt{\frac{2}{\frac{k}{\pi}}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 1.15e242Initial 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.f6435.9%
Simplified35.9%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6436.0%
Applied egg-rr36.0%
associate-/r*N/A
associate-/r/N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f6447.6%
Applied egg-rr47.6%
if 1.15e242 < 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
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
pow1/2N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr23.5%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 2.75e+242)
(* (sqrt n) (sqrt (* 2.0 (/ PI k))))
(pow (* t_0 t_0) 0.25))))
double code(double k, double n) {
double t_0 = 2.0 / (k / (((double) M_PI) * n));
double tmp;
if (k <= 2.75e+242) {
tmp = sqrt(n) * sqrt((2.0 * (((double) M_PI) / k)));
} else {
tmp = pow((t_0 * t_0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = 2.0 / (k / (Math.PI * n));
double tmp;
if (k <= 2.75e+242) {
tmp = Math.sqrt(n) * Math.sqrt((2.0 * (Math.PI / k)));
} else {
tmp = Math.pow((t_0 * t_0), 0.25);
}
return tmp;
}
def code(k, n): t_0 = 2.0 / (k / (math.pi * n)) tmp = 0 if k <= 2.75e+242: tmp = math.sqrt(n) * math.sqrt((2.0 * (math.pi / k))) else: tmp = math.pow((t_0 * t_0), 0.25) return tmp
function code(k, n) t_0 = Float64(2.0 / Float64(k / Float64(pi * n))) tmp = 0.0 if (k <= 2.75e+242) tmp = Float64(sqrt(n) * sqrt(Float64(2.0 * Float64(pi / k)))); else tmp = Float64(t_0 * t_0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) t_0 = 2.0 / (k / (pi * n)); tmp = 0.0; if (k <= 2.75e+242) tmp = sqrt(n) * sqrt((2.0 * (pi / k))); else tmp = (t_0 * t_0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(2.0 / N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2.75e+242], N[(N[Sqrt[n], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(Pi / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 0.25], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 2.75 \cdot 10^{+242}:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{2 \cdot \frac{\pi}{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 2.75000000000000011e242Initial 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.f6435.9%
Simplified35.9%
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.f6447.5%
Applied egg-rr47.5%
if 2.75000000000000011e242 < 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
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
pow1/2N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr23.5%
Final simplification45.4%
(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.6%
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.5%
Simplified99.5%
(FPCore (k n) :precision binary64 (let* ((t_0 (/ 2.0 (/ k (* PI n))))) (if (<= k 1.06e+230) (sqrt (* PI (* n (/ 2.0 k)))) (pow (* t_0 t_0) 0.25))))
double code(double k, double n) {
double t_0 = 2.0 / (k / (((double) M_PI) * n));
double tmp;
if (k <= 1.06e+230) {
tmp = sqrt((((double) M_PI) * (n * (2.0 / k))));
} else {
tmp = pow((t_0 * t_0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double t_0 = 2.0 / (k / (Math.PI * n));
double tmp;
if (k <= 1.06e+230) {
tmp = Math.sqrt((Math.PI * (n * (2.0 / k))));
} else {
tmp = Math.pow((t_0 * t_0), 0.25);
}
return tmp;
}
def code(k, n): t_0 = 2.0 / (k / (math.pi * n)) tmp = 0 if k <= 1.06e+230: tmp = math.sqrt((math.pi * (n * (2.0 / k)))) else: tmp = math.pow((t_0 * t_0), 0.25) return tmp
function code(k, n) t_0 = Float64(2.0 / Float64(k / Float64(pi * n))) tmp = 0.0 if (k <= 1.06e+230) tmp = sqrt(Float64(pi * Float64(n * Float64(2.0 / k)))); else tmp = Float64(t_0 * t_0) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) t_0 = 2.0 / (k / (pi * n)); tmp = 0.0; if (k <= 1.06e+230) tmp = sqrt((pi * (n * (2.0 / k)))); else tmp = (t_0 * t_0) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := Block[{t$95$0 = N[(2.0 / N[(k / N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.06e+230], N[Sqrt[N[(Pi * N[(n * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 0.25], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{\frac{k}{\pi \cdot n}}\\
\mathbf{if}\;k \leq 1.06 \cdot 10^{+230}:\\
\;\;\;\;\sqrt{\pi \cdot \left(n \cdot \frac{2}{k}\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 1.06e230Initial 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.f6436.6%
Simplified36.6%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6436.7%
Applied egg-rr36.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6436.7%
Applied egg-rr36.7%
if 1.06e230 < 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
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f642.7%
Applied egg-rr2.7%
pow1/2N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr19.8%
Final simplification34.9%
(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(pi * Float64(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[(Pi * N[(n * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\pi \cdot \left(n \cdot \frac{2}{k}\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.f6432.9%
Simplified32.9%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
clear-numN/A
associate-*l/N/A
metadata-evalN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6433.0%
Applied egg-rr33.0%
associate-/r/N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6433.0%
Applied egg-rr33.0%
Final simplification33.0%
herbie shell --seed 2024144
(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))))