
(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 0.5) (sqrt k)) (pow t_0 (/ k 2.0)))))
double code(double k, double n) {
double t_0 = 2.0 * (((double) M_PI) * n);
return (pow(t_0, 0.5) / sqrt(k)) / pow(t_0, (k / 2.0));
}
public static double code(double k, double n) {
double t_0 = 2.0 * (Math.PI * n);
return (Math.pow(t_0, 0.5) / Math.sqrt(k)) / Math.pow(t_0, (k / 2.0));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return (math.pow(t_0, 0.5) / math.sqrt(k)) / math.pow(t_0, (k / 2.0))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64(Float64((t_0 ^ 0.5) / sqrt(k)) / (t_0 ^ Float64(k / 2.0))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = ((t_0 ^ 0.5) / sqrt(k)) / (t_0 ^ (k / 2.0)); end
code[k_, n_] := Block[{t$95$0 = N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[t$95$0, 0.5], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, N[(k / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
\frac{\frac{{t\_0}^{0.5}}{\sqrt{k}}}{{t\_0}^{\left(\frac{k}{2}\right)}}
\end{array}
\end{array}
Initial program 99.4%
*-commutativeN/A
associate-*r*N/A
div-subN/A
metadata-evalN/A
pow-subN/A
associate-*l/N/A
/-lowering-/.f64N/A
un-div-invN/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
sqrt-lowering-sqrt.f64N/A
pow-lowering-pow.f64N/A
Applied egg-rr99.5%
(FPCore (k n) :precision binary64 (/ (pow (/ (* PI -2.0) (/ -1.0 n)) (- 0.5 (* 0.5 k))) (sqrt k)))
double code(double k, double n) {
return pow(((((double) M_PI) * -2.0) / (-1.0 / n)), (0.5 - (0.5 * k))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.pow(((Math.PI * -2.0) / (-1.0 / n)), (0.5 - (0.5 * k))) / Math.sqrt(k);
}
def code(k, n): return math.pow(((math.pi * -2.0) / (-1.0 / n)), (0.5 - (0.5 * k))) / math.sqrt(k)
function code(k, n) return Float64((Float64(Float64(pi * -2.0) / Float64(-1.0 / n)) ^ Float64(0.5 - Float64(0.5 * k))) / sqrt(k)) end
function tmp = code(k, n) tmp = (((pi * -2.0) / (-1.0 / n)) ^ (0.5 - (0.5 * k))) / sqrt(k); end
code[k_, n_] := N[(N[Power[N[(N[(Pi * -2.0), $MachinePrecision] / N[(-1.0 / n), $MachinePrecision]), $MachinePrecision], N[(0.5 - N[(0.5 * k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\frac{\pi \cdot -2}{\frac{-1}{n}}\right)}^{\left(0.5 - 0.5 \cdot k\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
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%
Taylor expanded in n around -inf
exp-prodN/A
pow-lowering-pow.f64N/A
mul-1-negN/A
unsub-negN/A
exp-diffN/A
/-lowering-/.f64N/A
rem-exp-logN/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
rem-exp-logN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.5%
Simplified99.5%
Final simplification99.5%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 1.3e+184)
(* (sqrt (* PI (/ 2.0 k))) (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.3e+184) {
tmp = sqrt((((double) M_PI) * (2.0 / k))) * 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.3e+184) {
tmp = Math.sqrt((Math.PI * (2.0 / k))) * 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.3e+184: tmp = math.sqrt((math.pi * (2.0 / k))) * 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.3e+184) tmp = Float64(sqrt(Float64(pi * Float64(2.0 / k))) * 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.3e+184) tmp = sqrt((pi * (2.0 / k))) * 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.3e+184], N[(N[Sqrt[N[(Pi * N[(2.0 / k), $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.3 \cdot 10^{+184}:\\
\;\;\;\;\sqrt{\pi \cdot \frac{2}{k}} \cdot \sqrt{n}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 1.29999999999999997e184Initial 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.f6443.1%
Simplified43.1%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f6443.1%
Applied egg-rr43.1%
sqrt-unprodN/A
associate-*r/N/A
associate-*l/N/A
*-commutativeN/A
associate-*l/N/A
associate-*r*N/A
sqrt-prodN/A
pow1/2N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
metadata-evalN/A
distribute-neg-fracN/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
PI-lowering-PI.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f6458.0%
Applied egg-rr58.0%
if 1.29999999999999997e184 < 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%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f642.7%
Applied egg-rr2.7%
*-commutativeN/A
associate-*r/N/A
clear-numN/A
sqrt-prodN/A
div-invN/A
pow1/2N/A
rem-exp-logN/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr14.4%
Final simplification51.0%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 1.7e+184)
(* (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 <= 1.7e+184) {
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 <= 1.7e+184) {
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 <= 1.7e+184: 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 <= 1.7e+184) 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 <= 1.7e+184) 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, 1.7e+184], 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 1.7 \cdot 10^{+184}:\\
\;\;\;\;\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 < 1.7000000000000001e184Initial 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.f6443.1%
Simplified43.1%
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.f6458.0%
Applied egg-rr58.0%
if 1.7000000000000001e184 < 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%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f642.7%
Applied egg-rr2.7%
*-commutativeN/A
associate-*r/N/A
clear-numN/A
sqrt-prodN/A
div-invN/A
pow1/2N/A
rem-exp-logN/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr14.4%
Final simplification51.0%
(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.4%
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 2.8e+174)
(pow (/ k (* 2.0 (* PI n))) -0.5)
(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.8e+174) {
tmp = pow((k / (2.0 * (((double) M_PI) * n))), -0.5);
} 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.8e+174) {
tmp = Math.pow((k / (2.0 * (Math.PI * n))), -0.5);
} 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.8e+174: tmp = math.pow((k / (2.0 * (math.pi * n))), -0.5) 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.8e+174) tmp = Float64(k / Float64(2.0 * Float64(pi * n))) ^ -0.5; 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.8e+174) tmp = (k / (2.0 * (pi * n))) ^ -0.5; 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.8e+174], N[Power[N[(k / N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $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.8 \cdot 10^{+174}:\\
\;\;\;\;{\left(\frac{k}{2 \cdot \left(\pi \cdot n\right)}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 2.7999999999999999e174Initial 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.f6444.1%
Simplified44.1%
sqrt-unprodN/A
associate-*l/N/A
*-commutativeN/A
*-commutativeN/A
sqrt-undivN/A
unpow1/2N/A
clear-numN/A
inv-powN/A
unpow1/2N/A
sqrt-undivN/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
Applied egg-rr44.4%
if 2.7999999999999999e174 < 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%
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f642.7%
Applied egg-rr2.7%
*-commutativeN/A
associate-*r/N/A
clear-numN/A
sqrt-prodN/A
div-invN/A
pow1/2N/A
rem-exp-logN/A
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr13.0%
(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.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.f6436.7%
Simplified36.7%
sqrt-unprodN/A
associate-*l/N/A
*-commutativeN/A
*-commutativeN/A
sqrt-undivN/A
unpow1/2N/A
clear-numN/A
inv-powN/A
unpow1/2N/A
sqrt-undivN/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
Applied egg-rr36.9%
(FPCore (k n) :precision binary64 (sqrt (* (/ PI k) (* 2.0 n))))
double code(double k, double n) {
return sqrt(((((double) M_PI) / k) * (2.0 * n)));
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI / k) * (2.0 * n)));
}
def code(k, n): return math.sqrt(((math.pi / k) * (2.0 * n)))
function code(k, n) return sqrt(Float64(Float64(pi / k) * Float64(2.0 * n))) end
function tmp = code(k, n) tmp = sqrt(((pi / k) * (2.0 * n))); end
code[k_, n_] := N[Sqrt[N[(N[(Pi / k), $MachinePrecision] * N[(2.0 * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{\pi}{k} \cdot \left(2 \cdot n\right)}
\end{array}
Initial 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.f6436.7%
Simplified36.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.f6436.7%
Applied egg-rr36.7%
clear-numN/A
associate-/r/N/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
associate-*l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6436.7%
Applied egg-rr36.7%
Final simplification36.7%
(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.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.f6436.7%
Simplified36.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.f6436.7%
Applied egg-rr36.7%
associate-/r/N/A
*-commutativeN/A
div-invN/A
metadata-evalN/A
distribute-lft-neg-inN/A
div-invN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6436.7%
Applied egg-rr36.7%
herbie shell --seed 2024155
(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))))