
(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 (* 2.0 (* PI n)))) (/ (* (pow t_0 (/ k -2.0)) (sqrt t_0)) (sqrt k))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return (pow(t_0, (k / -2.0)) * sqrt(t_0)) / sqrt(k);
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI * n);
return (Math.pow(t_0, (k / -2.0)) * Math.sqrt(t_0)) / Math.sqrt(k);
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.pow(t_0, (k / -2.0)) * math.sqrt(t_0)) / math.sqrt(k)
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64((t_0 ^ Float64(k / -2.0)) * sqrt(t_0)) / sqrt(k)) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = ((t_0 ^ (k / -2.0)) * sqrt(t_0)) / sqrt(k); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[t$95$0, N[(k / -2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{{t\_0}^{\left(\frac{k}{-2}\right)} \cdot \sqrt{t\_0}}{\sqrt{k}}
\end{array}
\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
sub-negN/A
+-lowering-+.f64N/A
metadata-evalN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
metadata-evalN/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
+-commutativeN/A
unpow-prod-upN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f6499.7%
Applied egg-rr99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* 2.0 (* PI n)))) (* (sqrt t_0) (pow (* k (pow t_0 k)) -0.5))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return sqrt(t_0) * 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.sqrt(t_0) * Math.pow((k * Math.pow(t_0, k)), -0.5);
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return math.sqrt(t_0) * math.pow((k * math.pow(t_0, k)), -0.5)
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(sqrt(t_0) * (Float64(k * (t_0 ^ k)) ^ -0.5)) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = sqrt(t_0) * ((k * (t_0 ^ k)) ^ -0.5); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[t$95$0], $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)\\
\sqrt{t\_0} \cdot {\left(k \cdot {t\_0}^{k}\right)}^{-0.5}
\end{array}
\end{array}
Initial program 99.6%
associate-*r*N/A
div-subN/A
metadata-evalN/A
sub-negN/A
distribute-neg-frac2N/A
metadata-evalN/A
associate-/r/N/A
clear-numN/A
unpow-prod-upN/A
associate-/l*N/A
*-lowering-*.f64N/A
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 4.7e+179) (/ (sqrt (* 2.0 (* PI n))) (sqrt k)) (pow (/ (* (* (* PI PI) 4.0) (* n n)) (* k k)) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = sqrt((2.0 * (((double) M_PI) * n))) / sqrt(k);
} else {
tmp = pow(((((((double) M_PI) * ((double) M_PI)) * 4.0) * (n * n)) / (k * k)), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = Math.sqrt((2.0 * (Math.PI * n))) / Math.sqrt(k);
} else {
tmp = Math.pow(((((Math.PI * Math.PI) * 4.0) * (n * n)) / (k * k)), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.7e+179: tmp = math.sqrt((2.0 * (math.pi * n))) / math.sqrt(k) else: tmp = math.pow(((((math.pi * math.pi) * 4.0) * (n * n)) / (k * k)), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.7e+179) tmp = Float64(sqrt(Float64(2.0 * Float64(pi * n))) / sqrt(k)); else tmp = Float64(Float64(Float64(Float64(pi * pi) * 4.0) * Float64(n * n)) / Float64(k * k)) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.7e+179) tmp = sqrt((2.0 * (pi * n))) / sqrt(k); else tmp = ((((pi * pi) * 4.0) * (n * n)) / (k * k)) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.7e+179], N[(N[Sqrt[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(N[(N[(Pi * Pi), $MachinePrecision] * 4.0), $MachinePrecision] * N[(n * n), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.7 \cdot 10^{+179}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\pi \cdot n\right)}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{\left(\left(\pi \cdot \pi\right) \cdot 4\right) \cdot \left(n \cdot n\right)}{k \cdot k}\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%
*-commutativeN/A
sqrt-divN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-commutativeN/A
sqrt-prodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.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
*-commutativeN/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
associate-*l/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%
associate-*l*N/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
unpow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr30.8%
(FPCore (k n) :precision binary64 (if (<= k 4.7e+179) (* (sqrt n) (sqrt (* 2.0 (/ PI k)))) (pow (/ (* (* (* PI PI) 4.0) (* n n)) (* k k)) 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(((((((double) M_PI) * ((double) M_PI)) * 4.0) * (n * n)) / (k * k)), 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(((((Math.PI * Math.PI) * 4.0) * (n * n)) / (k * k)), 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(((((math.pi * math.pi) * 4.0) * (n * n)) / (k * k)), 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(Float64(Float64(pi * pi) * 4.0) * Float64(n * n)) / Float64(k * k)) ^ 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 = ((((pi * pi) * 4.0) * (n * n)) / (k * k)) ^ 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[(N[(N[(Pi * Pi), $MachinePrecision] * 4.0), $MachinePrecision] * N[(n * n), $MachinePrecision]), $MachinePrecision] / N[(k * k), $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{\left(\left(\pi \cdot \pi\right) \cdot 4\right) \cdot \left(n \cdot n\right)}{k \cdot k}\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
*-commutativeN/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
associate-*l/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%
associate-*l*N/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
unpow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr30.8%
Final simplification59.0%
(FPCore (k n) :precision binary64 (/ (pow (* 2.0 (* PI n)) (+ (/ k -2.0) 0.5)) (sqrt k)))
double code(double k, double n) {
return pow((2.0 * (((double) M_PI) * n)), ((k / -2.0) + 0.5)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow((2.0 * (Math.PI * n)), ((k / -2.0) + 0.5)) / Math.sqrt(k);
}
def code(k, n): return math.pow((2.0 * (math.pi * n)), ((k / -2.0) + 0.5)) / math.sqrt(k)
function code(k, n) return Float64((Float64(2.0 * Float64(pi * n)) ^ Float64(Float64(k / -2.0) + 0.5)) / sqrt(k)) end
function tmp = code(k, n) tmp = ((2.0 * (pi * n)) ^ ((k / -2.0) + 0.5)) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(N[(k / -2.0), $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\frac{k}{-2} + 0.5\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
sub-negN/A
+-lowering-+.f64N/A
metadata-evalN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
metadata-evalN/A
sqrt-lowering-sqrt.f6499.6%
Simplified99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (if (<= k 4.7e+179) (pow (/ k (* 2.0 (* PI n))) -0.5) (pow (/ (* (* (* PI PI) 4.0) (* n n)) (* k k)) 0.25)))
double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = pow((k / (2.0 * (((double) M_PI) * n))), -0.5);
} else {
tmp = pow(((((((double) M_PI) * ((double) M_PI)) * 4.0) * (n * n)) / (k * k)), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.7e+179) {
tmp = Math.pow((k / (2.0 * (Math.PI * n))), -0.5);
} else {
tmp = Math.pow(((((Math.PI * Math.PI) * 4.0) * (n * n)) / (k * k)), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.7e+179: tmp = math.pow((k / (2.0 * (math.pi * n))), -0.5) else: tmp = math.pow(((((math.pi * math.pi) * 4.0) * (n * n)) / (k * k)), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.7e+179) tmp = Float64(k / Float64(2.0 * Float64(pi * n))) ^ -0.5; else tmp = Float64(Float64(Float64(Float64(pi * pi) * 4.0) * Float64(n * n)) / Float64(k * k)) ^ 0.25; end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.7e+179) tmp = (k / (2.0 * (pi * n))) ^ -0.5; else tmp = ((((pi * pi) * 4.0) * (n * n)) / (k * k)) ^ 0.25; end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.7e+179], N[Power[N[(k / N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision], N[Power[N[(N[(N[(N[(Pi * Pi), $MachinePrecision] * 4.0), $MachinePrecision] * N[(n * n), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.7 \cdot 10^{+179}:\\
\;\;\;\;{\left(\frac{k}{2 \cdot \left(\pi \cdot n\right)}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{\left(\left(\pi \cdot \pi\right) \cdot 4\right) \cdot \left(n \cdot n\right)}{k \cdot k}\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%
*-commutativeN/A
sqrt-divN/A
associate-/l*N/A
clear-numN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
sqrt-undivN/A
sqrt-pow2N/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.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
*-commutativeN/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
associate-*l/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%
associate-*l*N/A
*-commutativeN/A
associate-*l/N/A
associate-*r/N/A
unpow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr30.8%
(FPCore (k n) :precision binary64 (pow (/ k (* 2.0 (* PI n))) -0.5))
double code(double k, double n) {
return pow((k / (2.0 * (((double) M_PI) * n))), -0.5);
}
public static double code(double k, double n) {
return Math.pow((k / (2.0 * (Math.PI * n))), -0.5);
}
def code(k, n): return math.pow((k / (2.0 * (math.pi * n))), -0.5)
function code(k, n) return Float64(k / Float64(2.0 * Float64(pi * n))) ^ -0.5 end
function tmp = code(k, n) tmp = (k / (2.0 * (pi * n))) ^ -0.5; end
code[k_, n_] := N[Power[N[(k / N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{k}{2 \cdot \left(\pi \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%
*-commutativeN/A
sqrt-divN/A
associate-/l*N/A
clear-numN/A
inv-powN/A
*-commutativeN/A
sqrt-prodN/A
sqrt-undivN/A
sqrt-pow2N/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6442.7%
Applied egg-rr42.7%
(FPCore (k n) :precision binary64 (sqrt (* (/ n k) (* 2.0 PI))))
double code(double k, double n) {
return sqrt(((n / k) * (2.0 * ((double) M_PI))));
}
public static double code(double k, double n) {
return Math.sqrt(((n / k) * (2.0 * Math.PI)));
}
def code(k, n): return math.sqrt(((n / k) * (2.0 * math.pi)))
function code(k, n) return sqrt(Float64(Float64(n / k) * Float64(2.0 * pi))) end
function tmp = code(k, n) tmp = sqrt(((n / k) * (2.0 * pi))); end
code[k_, n_] := N[Sqrt[N[(N[(n / k), $MachinePrecision] * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n}{k} \cdot \left(2 \cdot \pi\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
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6442.2%
Applied egg-rr42.2%
associate-/l*N/A
associate-*r*N/A
*-commutativeN/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 (/ (* 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(2.0 * Float64(Float64(pi * n) / k))) end
function tmp = code(k, n) tmp = sqrt((2.0 * ((pi * n) / k))); end
code[k_, n_] := N[Sqrt[N[(2.0 * N[(N[(Pi * n), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\pi \cdot n}{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
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-commutativeN/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))))