
(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 (/ k -2.0)) (* (sqrt t_0) (pow k -0.5)))))
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) * pow(k, -0.5));
}
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.pow(k, -0.5));
}
def code(k, n): t_0 = 2.0 * (math.pi * n) return math.pow(t_0, (k / -2.0)) * (math.sqrt(t_0) * math.pow(k, -0.5))
function code(k, n) t_0 = Float64(2.0 * Float64(pi * n)) return Float64((t_0 ^ Float64(k / -2.0)) * Float64(sqrt(t_0) * (k ^ -0.5))) end
function tmp = code(k, n) t_0 = 2.0 * (pi * n); tmp = (t_0 ^ (k / -2.0)) * (sqrt(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, N[(k / -2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\pi \cdot n\right)\\
{t\_0}^{\left(\frac{k}{-2}\right)} \cdot \left(\sqrt{t\_0} \cdot {k}^{-0.5}\right)
\end{array}
\end{array}
Initial program 99.6%
*-commutativeN/A
associate-*r*N/A
div-subN/A
metadata-evalN/A
sub-negN/A
distribute-neg-frac2N/A
metadata-evalN/A
+-commutativeN/A
unpow-prod-upN/A
associate-*l*N/A
*-lowering-*.f64N/A
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.9e-45) (* (sqrt (* 2.0 (* PI n))) (pow k -0.5)) (/ (sqrt (* PI n)) (pow (/ (* k k) 4.0) 0.25))))
double code(double k, double n) {
double tmp;
if (k <= 4.9e-45) {
tmp = sqrt((2.0 * (((double) M_PI) * n))) * pow(k, -0.5);
} else {
tmp = sqrt((((double) M_PI) * n)) / pow(((k * k) / 4.0), 0.25);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 4.9e-45) {
tmp = Math.sqrt((2.0 * (Math.PI * n))) * Math.pow(k, -0.5);
} else {
tmp = Math.sqrt((Math.PI * n)) / Math.pow(((k * k) / 4.0), 0.25);
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 4.9e-45: tmp = math.sqrt((2.0 * (math.pi * n))) * math.pow(k, -0.5) else: tmp = math.sqrt((math.pi * n)) / math.pow(((k * k) / 4.0), 0.25) return tmp
function code(k, n) tmp = 0.0 if (k <= 4.9e-45) tmp = Float64(sqrt(Float64(2.0 * Float64(pi * n))) * (k ^ -0.5)); else tmp = Float64(sqrt(Float64(pi * n)) / (Float64(Float64(k * k) / 4.0) ^ 0.25)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 4.9e-45) tmp = sqrt((2.0 * (pi * n))) * (k ^ -0.5); else tmp = sqrt((pi * n)) / (((k * k) / 4.0) ^ 0.25); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 4.9e-45], N[(N[Sqrt[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(Pi * n), $MachinePrecision]], $MachinePrecision] / N[Power[N[(N[(k * k), $MachinePrecision] / 4.0), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.9 \cdot 10^{-45}:\\
\;\;\;\;\sqrt{2 \cdot \left(\pi \cdot n\right)} \cdot {k}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\pi \cdot n}}{{\left(\frac{k \cdot k}{4}\right)}^{0.25}}\\
\end{array}
\end{array}
if k < 4.8999999999999998e-45Initial 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.f6475.7%
Simplified75.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6475.9%
Applied egg-rr75.9%
pow1/2N/A
clear-numN/A
associate-/r/N/A
unpow-prod-downN/A
inv-powN/A
pow-powN/A
metadata-evalN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6499.5%
Applied egg-rr99.5%
if 4.8999999999999998e-45 < 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.8%
Simplified13.8%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6413.8%
Applied egg-rr13.8%
associate-*r*N/A
*-commutativeN/A
associate-*l/N/A
metadata-evalN/A
div-invN/A
associate-/l/N/A
sqrt-divN/A
pow1/2N/A
sqrt-unprodN/A
/-lowering-/.f64N/A
pow1/2N/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-commutativeN/A
pow1/2N/A
pow1/2N/A
pow-prod-downN/A
metadata-evalN/A
div-invN/A
pow-lowering-pow.f64N/A
/-lowering-/.f6415.1%
Applied egg-rr15.1%
metadata-evalN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
frac-timesN/A
metadata-evalN/A
metadata-evalN/A
frac-timesN/A
pow-lowering-pow.f64N/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-eval29.5%
Applied egg-rr29.5%
Final simplification57.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 3.1e+230)
(* (sqrt (* 2.0 (* PI n))) (pow k -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 <= 3.1e+230) {
tmp = sqrt((2.0 * (((double) M_PI) * n))) * pow(k, -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 <= 3.1e+230) {
tmp = Math.sqrt((2.0 * (Math.PI * n))) * Math.pow(k, -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 <= 3.1e+230: tmp = math.sqrt((2.0 * (math.pi * n))) * math.pow(k, -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 <= 3.1e+230) tmp = Float64(sqrt(Float64(2.0 * Float64(pi * n))) * (k ^ -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 <= 3.1e+230) tmp = sqrt((2.0 * (pi * n))) * (k ^ -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, 3.1e+230], N[(N[Sqrt[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[k, -0.5], $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 3.1 \cdot 10^{+230}:\\
\;\;\;\;\sqrt{2 \cdot \left(\pi \cdot n\right)} \cdot {k}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;{\left(t\_0 \cdot t\_0\right)}^{0.25}\\
\end{array}
\end{array}
if k < 3.09999999999999981e230Initial 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.f6442.4%
Simplified42.4%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6442.5%
Applied egg-rr42.5%
pow1/2N/A
clear-numN/A
associate-/r/N/A
unpow-prod-downN/A
inv-powN/A
pow-powN/A
metadata-evalN/A
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6453.8%
Applied egg-rr53.8%
if 3.09999999999999981e230 < 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
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f642.7%
Applied egg-rr2.7%
pow1/2N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr22.6%
Final simplification50.9%
(FPCore (k n) :precision binary64 (* (pow k -0.5) (pow (* 2.0 (* PI n)) (+ (/ k -2.0) 0.5))))
double code(double k, double n) {
return pow(k, -0.5) * pow((2.0 * (((double) M_PI) * n)), ((k / -2.0) + 0.5));
}
public static double code(double k, double n) {
return Math.pow(k, -0.5) * Math.pow((2.0 * (Math.PI * n)), ((k / -2.0) + 0.5));
}
def code(k, n): return math.pow(k, -0.5) * math.pow((2.0 * (math.pi * n)), ((k / -2.0) + 0.5))
function code(k, n) return Float64((k ^ -0.5) * (Float64(2.0 * Float64(pi * n)) ^ Float64(Float64(k / -2.0) + 0.5))) end
function tmp = code(k, n) tmp = (k ^ -0.5) * ((2.0 * (pi * n)) ^ ((k / -2.0) + 0.5)); end
code[k_, n_] := N[(N[Power[k, -0.5], $MachinePrecision] * N[Power[N[(2.0 * N[(Pi * n), $MachinePrecision]), $MachinePrecision], N[(N[(k / -2.0), $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{k}^{-0.5} \cdot {\left(2 \cdot \left(\pi \cdot n\right)\right)}^{\left(\frac{k}{-2} + 0.5\right)}
\end{array}
Initial program 99.6%
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r*N/A
pow-lowering-pow.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
div-subN/A
metadata-evalN/A
sub-negN/A
distribute-neg-frac2N/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (k n)
:precision binary64
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 8.8e+230)
(* (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 <= 8.8e+230) {
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 <= 8.8e+230) {
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 <= 8.8e+230: 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 <= 8.8e+230) 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 <= 8.8e+230) 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, 8.8e+230], 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 8.8 \cdot 10^{+230}:\\
\;\;\;\;\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 < 8.8000000000000004e230Initial 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.f6442.4%
Simplified42.4%
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.f6453.8%
Applied egg-rr53.8%
if 8.8000000000000004e230 < 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
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f642.7%
Applied egg-rr2.7%
pow1/2N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr22.6%
Final simplification50.9%
(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
(let* ((t_0 (/ 2.0 (/ k (* PI n)))))
(if (<= k 3.6e+220)
(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 <= 3.6e+220) {
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 <= 3.6e+220) {
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 <= 3.6e+220: 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 <= 3.6e+220) 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 <= 3.6e+220) 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, 3.6e+220], 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 3.6 \cdot 10^{+220}:\\
\;\;\;\;{\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 < 3.60000000000000019e220Initial 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.f6443.7%
Simplified43.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6443.8%
Applied egg-rr43.8%
clear-numN/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6444.4%
Applied egg-rr44.4%
if 3.60000000000000019e220 < 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
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f642.6%
Applied egg-rr2.6%
pow1/2N/A
sqr-powN/A
pow-prod-downN/A
pow-lowering-pow.f64N/A
Applied egg-rr18.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.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.f6438.7%
Simplified38.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6438.8%
Applied egg-rr38.8%
clear-numN/A
inv-powN/A
sqrt-pow1N/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-lowering-/.f64N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6439.3%
Applied egg-rr39.3%
(FPCore (k n) :precision binary64 (sqrt (/ (* 2.0 n) (/ k PI))))
double code(double k, double n) {
return sqrt(((2.0 * n) / (k / ((double) M_PI))));
}
public static double code(double k, double n) {
return Math.sqrt(((2.0 * n) / (k / Math.PI)));
}
def code(k, n): return math.sqrt(((2.0 * n) / (k / math.pi)))
function code(k, n) return sqrt(Float64(Float64(2.0 * n) / Float64(k / pi))) end
function tmp = code(k, n) tmp = sqrt(((2.0 * n) / (k / pi))); end
code[k_, n_] := N[Sqrt[N[(N[(2.0 * n), $MachinePrecision] / N[(k / Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{2 \cdot n}{\frac{k}{\pi}}}
\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.f6438.7%
Simplified38.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6438.8%
Applied egg-rr38.8%
*-commutativeN/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6438.8%
Applied egg-rr38.8%
(FPCore (k n) :precision binary64 (sqrt (* n (* PI (/ 2.0 k)))))
double code(double k, double n) {
return sqrt((n * (((double) M_PI) * (2.0 / k))));
}
public static double code(double k, double n) {
return Math.sqrt((n * (Math.PI * (2.0 / k))));
}
def code(k, n): return math.sqrt((n * (math.pi * (2.0 / k))))
function code(k, n) return sqrt(Float64(n * Float64(pi * Float64(2.0 / k)))) end
function tmp = code(k, n) tmp = sqrt((n * (pi * (2.0 / k)))); end
code[k_, n_] := N[Sqrt[N[(n * N[(Pi * N[(2.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{n \cdot \left(\pi \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.f6438.7%
Simplified38.7%
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
/-lowering-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6438.8%
Applied egg-rr38.8%
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-*l*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 2024192
(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))))