
(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}
Herbie found 15 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 3e-41) (/ (* n (sqrt (* 2.0 (/ PI n)))) (sqrt k)) (sqrt (/ (pow (* (+ PI PI) n) (- 1.0 k)) k))))
double code(double k, double n) {
double tmp;
if (k <= 3e-41) {
tmp = (n * sqrt((2.0 * (((double) M_PI) / n)))) / sqrt(k);
} else {
tmp = sqrt((pow(((((double) M_PI) + ((double) M_PI)) * n), (1.0 - k)) / k));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 3e-41) {
tmp = (n * Math.sqrt((2.0 * (Math.PI / n)))) / Math.sqrt(k);
} else {
tmp = Math.sqrt((Math.pow(((Math.PI + Math.PI) * n), (1.0 - k)) / k));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 3e-41: tmp = (n * math.sqrt((2.0 * (math.pi / n)))) / math.sqrt(k) else: tmp = math.sqrt((math.pow(((math.pi + math.pi) * n), (1.0 - k)) / k)) return tmp
function code(k, n) tmp = 0.0 if (k <= 3e-41) tmp = Float64(Float64(n * sqrt(Float64(2.0 * Float64(pi / n)))) / sqrt(k)); else tmp = sqrt(Float64((Float64(Float64(pi + pi) * n) ^ Float64(1.0 - k)) / k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 3e-41) tmp = (n * sqrt((2.0 * (pi / n)))) / sqrt(k); else tmp = sqrt(((((pi + pi) * n) ^ (1.0 - k)) / k)); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 3e-41], N[(N[(n * N[Sqrt[N[(2.0 * N[(Pi / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{-41}:\\
\;\;\;\;\frac{n \cdot \sqrt{2 \cdot \frac{\pi}{n}}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(\left(\pi + \pi\right) \cdot n\right)}^{\left(1 - k\right)}}{k}}\\
\end{array}
\end{array}
if k < 2.99999999999999989e-41Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Taylor expanded in n around inf
Applied rewrites50.2%
if 2.99999999999999989e-41 < k Initial program 99.4%
Applied rewrites99.4%
Applied rewrites99.3%
Applied rewrites87.5%
(FPCore (k n)
:precision binary64
(let* ((t_0 (sqrt (* (+ PI PI) n))))
(*
(/ (fma 1.0 (sqrt k) (* (sqrt k) 0.0)) k)
(* t_0 (exp (* (log t_0) (- k)))))))
double code(double k, double n) {
double t_0 = sqrt(((((double) M_PI) + ((double) M_PI)) * n));
return (fma(1.0, sqrt(k), (sqrt(k) * 0.0)) / k) * (t_0 * exp((log(t_0) * -k)));
}
function code(k, n) t_0 = sqrt(Float64(Float64(pi + pi) * n)) return Float64(Float64(fma(1.0, sqrt(k), Float64(sqrt(k) * 0.0)) / k) * Float64(t_0 * exp(Float64(log(t_0) * Float64(-k))))) end
code[k_, n_] := Block[{t$95$0 = N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(1.0 * N[Sqrt[k], $MachinePrecision] + N[(N[Sqrt[k], $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[(t$95$0 * N[Exp[N[(N[Log[t$95$0], $MachinePrecision] * (-k)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\left(\pi + \pi\right) \cdot n}\\
\frac{\mathsf{fma}\left(1, \sqrt{k}, \sqrt{k} \cdot 0\right)}{k} \cdot \left(t\_0 \cdot e^{\log t\_0 \cdot \left(-k\right)}\right)
\end{array}
\end{array}
Initial program 99.4%
Applied rewrites99.4%
Applied rewrites99.3%
(FPCore (k n) :precision binary64 (* (/ (fma 1.0 (sqrt k) (* (sqrt k) 0.0)) k) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
double code(double k, double n) {
return (fma(1.0, sqrt(k), (sqrt(k) * 0.0)) / k) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
function code(k, n) return Float64(Float64(fma(1.0, sqrt(k), Float64(sqrt(k) * 0.0)) / k) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0))) end
code[k_, n_] := N[(N[(N[(1.0 * N[Sqrt[k], $MachinePrecision] + N[(N[Sqrt[k], $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision] / k), $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{\mathsf{fma}\left(1, \sqrt{k}, \sqrt{k} \cdot 0\right)}{k} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 99.4%
Applied rewrites99.4%
(FPCore (k n) :precision binary64 (/ (sqrt (pow (sqrt (* (+ PI PI) n)) (fma k -2.0 2.0))) (sqrt k)))
double code(double k, double n) {
return sqrt(pow(sqrt(((((double) M_PI) + ((double) M_PI)) * n)), fma(k, -2.0, 2.0))) / sqrt(k);
}
function code(k, n) return Float64(sqrt((sqrt(Float64(Float64(pi + pi) * n)) ^ fma(k, -2.0, 2.0))) / sqrt(k)) end
code[k_, n_] := N[(N[Sqrt[N[Power[N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision], N[(k * -2.0 + 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{{\left(\sqrt{\left(\pi + \pi\right) \cdot n}\right)}^{\left(\mathsf{fma}\left(k, -2, 2\right)\right)}}}{\sqrt{k}}
\end{array}
Initial program 99.4%
Applied rewrites99.4%
Applied rewrites99.4%
Applied rewrites99.3%
Applied rewrites99.3%
(FPCore (k n) :precision binary64 (/ (pow (* (+ PI PI) n) (fma k -0.5 0.5)) (sqrt k)))
double code(double k, double n) {
return pow(((((double) M_PI) + ((double) M_PI)) * n), fma(k, -0.5, 0.5)) / sqrt(k);
}
function code(k, n) return Float64((Float64(Float64(pi + pi) * n) ^ fma(k, -0.5, 0.5)) / sqrt(k)) end
code[k_, n_] := N[(N[Power[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision], N[(k * -0.5 + 0.5), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(\left(\pi + \pi\right) \cdot n\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
Applied rewrites99.5%
(FPCore (k n) :precision binary64 (/ (sqrt (pow (* (+ PI PI) n) (- 1.0 k))) (sqrt k)))
double code(double k, double n) {
return sqrt(pow(((((double) M_PI) + ((double) M_PI)) * n), (1.0 - k))) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt(Math.pow(((Math.PI + Math.PI) * n), (1.0 - k))) / Math.sqrt(k);
}
def code(k, n): return math.sqrt(math.pow(((math.pi + math.pi) * n), (1.0 - k))) / math.sqrt(k)
function code(k, n) return Float64(sqrt((Float64(Float64(pi + pi) * n) ^ Float64(1.0 - k))) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt((((pi + pi) * n) ^ (1.0 - k))) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[Power[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision], N[(1.0 - k), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{{\left(\left(\pi + \pi\right) \cdot n\right)}^{\left(1 - k\right)}}}{\sqrt{k}}
\end{array}
Initial program 99.4%
Applied rewrites99.4%
Applied rewrites99.4%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0)))))
(if (<= t_0 0.0)
(sqrt (* (+ PI PI) (/ n (sqrt (sqrt (* (* k k) (* k k)))))))
(if (<= t_0 4e+296)
(* (/ (fma 1.0 (sqrt k) (* (sqrt k) 0.0)) k) (sqrt (* 2.0 (* n PI))))
(/
(sqrt (* (+ PI PI) n))
(* k (sqrt (sqrt (* (/ 1.0 k) (/ 1.0 k))))))))))
double code(double k, double n) {
double t_0 = (1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt(((((double) M_PI) + ((double) M_PI)) * (n / sqrt(sqrt(((k * k) * (k * k)))))));
} else if (t_0 <= 4e+296) {
tmp = (fma(1.0, sqrt(k), (sqrt(k) * 0.0)) / k) * sqrt((2.0 * (n * ((double) M_PI))));
} else {
tmp = sqrt(((((double) M_PI) + ((double) M_PI)) * n)) / (k * sqrt(sqrt(((1.0 / k) * (1.0 / k)))));
}
return tmp;
}
function code(k, n) t_0 = Float64(Float64(1.0 / sqrt(k)) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0))) tmp = 0.0 if (t_0 <= 0.0) tmp = sqrt(Float64(Float64(pi + pi) * Float64(n / sqrt(sqrt(Float64(Float64(k * k) * Float64(k * k))))))); elseif (t_0 <= 4e+296) tmp = Float64(Float64(fma(1.0, sqrt(k), Float64(sqrt(k) * 0.0)) / k) * sqrt(Float64(2.0 * Float64(n * pi)))); else tmp = Float64(sqrt(Float64(Float64(pi + pi) * n)) / Float64(k * sqrt(sqrt(Float64(Float64(1.0 / k) * Float64(1.0 / k)))))); end return tmp end
code[k_, n_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 0.0], N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * N[(n / N[Sqrt[N[Sqrt[N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 4e+296], N[(N[(N[(1.0 * N[Sqrt[k], $MachinePrecision] + N[(N[Sqrt[k], $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(n * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision] / N[(k * N[Sqrt[N[Sqrt[N[(N[(1.0 / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\sqrt{\left(\pi + \pi\right) \cdot \frac{n}{\sqrt{\sqrt{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}}}}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+296}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1, \sqrt{k}, \sqrt{k} \cdot 0\right)}{k} \cdot \sqrt{2 \cdot \left(n \cdot \pi\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(\pi + \pi\right) \cdot n}}{k \cdot \sqrt{\sqrt{\frac{1}{k} \cdot \frac{1}{k}}}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 k)) (pow.f64 (*.f64 (*.f64 #s(literal 2 binary64) (PI.f64)) n) (/.f64 (-.f64 #s(literal 1 binary64) k) #s(literal 2 binary64)))) < 0.0Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Applied rewrites35.9%
Applied rewrites31.8%
if 0.0 < (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 k)) (pow.f64 (*.f64 (*.f64 #s(literal 2 binary64) (PI.f64)) n) (/.f64 (-.f64 #s(literal 1 binary64) k) #s(literal 2 binary64)))) < 3.99999999999999993e296Initial program 99.4%
Applied rewrites99.4%
Applied rewrites99.3%
Taylor expanded in k around 0
Applied rewrites50.1%
if 3.99999999999999993e296 < (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 k)) (pow.f64 (*.f64 (*.f64 #s(literal 2 binary64) (PI.f64)) n) (/.f64 (-.f64 #s(literal 1 binary64) k) #s(literal 2 binary64)))) Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Taylor expanded in k around inf
Applied rewrites50.1%
Applied rewrites50.1%
Applied rewrites36.6%
(FPCore (k n) :precision binary64 (if (<= (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))) 5e-124) (sqrt (* (+ PI PI) (/ n (sqrt (sqrt (* (* k k) (* k k))))))) (/ (* n (sqrt (* 2.0 (/ PI n)))) (sqrt k))))
double code(double k, double n) {
double tmp;
if (((1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0))) <= 5e-124) {
tmp = sqrt(((((double) M_PI) + ((double) M_PI)) * (n / sqrt(sqrt(((k * k) * (k * k)))))));
} else {
tmp = (n * sqrt((2.0 * (((double) M_PI) / n)))) / sqrt(k);
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (((1.0 / Math.sqrt(k)) * Math.pow(((2.0 * Math.PI) * n), ((1.0 - k) / 2.0))) <= 5e-124) {
tmp = Math.sqrt(((Math.PI + Math.PI) * (n / Math.sqrt(Math.sqrt(((k * k) * (k * k)))))));
} else {
tmp = (n * Math.sqrt((2.0 * (Math.PI / n)))) / Math.sqrt(k);
}
return tmp;
}
def code(k, n): tmp = 0 if ((1.0 / math.sqrt(k)) * math.pow(((2.0 * math.pi) * n), ((1.0 - k) / 2.0))) <= 5e-124: tmp = math.sqrt(((math.pi + math.pi) * (n / math.sqrt(math.sqrt(((k * k) * (k * k))))))) else: tmp = (n * math.sqrt((2.0 * (math.pi / n)))) / math.sqrt(k) return tmp
function code(k, n) tmp = 0.0 if (Float64(Float64(1.0 / sqrt(k)) * (Float64(Float64(2.0 * pi) * n) ^ Float64(Float64(1.0 - k) / 2.0))) <= 5e-124) tmp = sqrt(Float64(Float64(pi + pi) * Float64(n / sqrt(sqrt(Float64(Float64(k * k) * Float64(k * k))))))); else tmp = Float64(Float64(n * sqrt(Float64(2.0 * Float64(pi / n)))) / sqrt(k)); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (((1.0 / sqrt(k)) * (((2.0 * pi) * n) ^ ((1.0 - k) / 2.0))) <= 5e-124) tmp = sqrt(((pi + pi) * (n / sqrt(sqrt(((k * k) * (k * k))))))); else tmp = (n * sqrt((2.0 * (pi / n)))) / sqrt(k); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[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], 5e-124], N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * N[(n / N[Sqrt[N[Sqrt[N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(n * N[Sqrt[N[(2.0 * N[(Pi / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \leq 5 \cdot 10^{-124}:\\
\;\;\;\;\sqrt{\left(\pi + \pi\right) \cdot \frac{n}{\sqrt{\sqrt{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \sqrt{2 \cdot \frac{\pi}{n}}}{\sqrt{k}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 k)) (pow.f64 (*.f64 (*.f64 #s(literal 2 binary64) (PI.f64)) n) (/.f64 (-.f64 #s(literal 1 binary64) k) #s(literal 2 binary64)))) < 5.0000000000000003e-124Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Applied rewrites35.9%
Applied rewrites31.8%
if 5.0000000000000003e-124 < (*.f64 (/.f64 #s(literal 1 binary64) (sqrt.f64 k)) (pow.f64 (*.f64 (*.f64 #s(literal 2 binary64) (PI.f64)) n) (/.f64 (-.f64 #s(literal 1 binary64) k) #s(literal 2 binary64)))) Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Taylor expanded in n around inf
Applied rewrites50.2%
(FPCore (k n)
:precision binary64
(if (<= k 2.8e-31)
(/ (* n (sqrt (* 2.0 (/ PI n)))) (sqrt k))
(if (<= k 1.9e+164)
(* n (sqrt (* 2.0 (/ PI (* k n)))))
(sqrt (* (+ PI PI) (/ n (sqrt (* k k))))))))
double code(double k, double n) {
double tmp;
if (k <= 2.8e-31) {
tmp = (n * sqrt((2.0 * (((double) M_PI) / n)))) / sqrt(k);
} else if (k <= 1.9e+164) {
tmp = n * sqrt((2.0 * (((double) M_PI) / (k * n))));
} else {
tmp = sqrt(((((double) M_PI) + ((double) M_PI)) * (n / sqrt((k * k)))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.8e-31) {
tmp = (n * Math.sqrt((2.0 * (Math.PI / n)))) / Math.sqrt(k);
} else if (k <= 1.9e+164) {
tmp = n * Math.sqrt((2.0 * (Math.PI / (k * n))));
} else {
tmp = Math.sqrt(((Math.PI + Math.PI) * (n / Math.sqrt((k * k)))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2.8e-31: tmp = (n * math.sqrt((2.0 * (math.pi / n)))) / math.sqrt(k) elif k <= 1.9e+164: tmp = n * math.sqrt((2.0 * (math.pi / (k * n)))) else: tmp = math.sqrt(((math.pi + math.pi) * (n / math.sqrt((k * k))))) return tmp
function code(k, n) tmp = 0.0 if (k <= 2.8e-31) tmp = Float64(Float64(n * sqrt(Float64(2.0 * Float64(pi / n)))) / sqrt(k)); elseif (k <= 1.9e+164) tmp = Float64(n * sqrt(Float64(2.0 * Float64(pi / Float64(k * n))))); else tmp = sqrt(Float64(Float64(pi + pi) * Float64(n / sqrt(Float64(k * k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.8e-31) tmp = (n * sqrt((2.0 * (pi / n)))) / sqrt(k); elseif (k <= 1.9e+164) tmp = n * sqrt((2.0 * (pi / (k * n)))); else tmp = sqrt(((pi + pi) * (n / sqrt((k * k))))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.8e-31], N[(N[(n * N[Sqrt[N[(2.0 * N[(Pi / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.9e+164], N[(n * N[Sqrt[N[(2.0 * N[(Pi / N[(k * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * N[(n / N[Sqrt[N[(k * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{n \cdot \sqrt{2 \cdot \frac{\pi}{n}}}{\sqrt{k}}\\
\mathbf{elif}\;k \leq 1.9 \cdot 10^{+164}:\\
\;\;\;\;n \cdot \sqrt{2 \cdot \frac{\pi}{k \cdot n}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\pi + \pi\right) \cdot \frac{n}{\sqrt{k \cdot k}}}\\
\end{array}
\end{array}
if k < 2.7999999999999999e-31Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Taylor expanded in n around inf
Applied rewrites50.2%
if 2.7999999999999999e-31 < k < 1.90000000000000011e164Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Taylor expanded in n around inf
Applied rewrites50.4%
if 1.90000000000000011e164 < k Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Applied rewrites35.9%
(FPCore (k n)
:precision binary64
(if (<= k 2.8e-31)
(/ (* (sqrt k) (sqrt (* 2.0 (* n PI)))) k)
(if (<= k 1.9e+164)
(* n (sqrt (* 2.0 (/ PI (* k n)))))
(sqrt (* (+ PI PI) (/ n (sqrt (* k k))))))))
double code(double k, double n) {
double tmp;
if (k <= 2.8e-31) {
tmp = (sqrt(k) * sqrt((2.0 * (n * ((double) M_PI))))) / k;
} else if (k <= 1.9e+164) {
tmp = n * sqrt((2.0 * (((double) M_PI) / (k * n))));
} else {
tmp = sqrt(((((double) M_PI) + ((double) M_PI)) * (n / sqrt((k * k)))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.8e-31) {
tmp = (Math.sqrt(k) * Math.sqrt((2.0 * (n * Math.PI)))) / k;
} else if (k <= 1.9e+164) {
tmp = n * Math.sqrt((2.0 * (Math.PI / (k * n))));
} else {
tmp = Math.sqrt(((Math.PI + Math.PI) * (n / Math.sqrt((k * k)))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2.8e-31: tmp = (math.sqrt(k) * math.sqrt((2.0 * (n * math.pi)))) / k elif k <= 1.9e+164: tmp = n * math.sqrt((2.0 * (math.pi / (k * n)))) else: tmp = math.sqrt(((math.pi + math.pi) * (n / math.sqrt((k * k))))) return tmp
function code(k, n) tmp = 0.0 if (k <= 2.8e-31) tmp = Float64(Float64(sqrt(k) * sqrt(Float64(2.0 * Float64(n * pi)))) / k); elseif (k <= 1.9e+164) tmp = Float64(n * sqrt(Float64(2.0 * Float64(pi / Float64(k * n))))); else tmp = sqrt(Float64(Float64(pi + pi) * Float64(n / sqrt(Float64(k * k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.8e-31) tmp = (sqrt(k) * sqrt((2.0 * (n * pi)))) / k; elseif (k <= 1.9e+164) tmp = n * sqrt((2.0 * (pi / (k * n)))); else tmp = sqrt(((pi + pi) * (n / sqrt((k * k))))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.8e-31], N[(N[(N[Sqrt[k], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(n * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[k, 1.9e+164], N[(n * N[Sqrt[N[(2.0 * N[(Pi / N[(k * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * N[(n / N[Sqrt[N[(k * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{\sqrt{k} \cdot \sqrt{2 \cdot \left(n \cdot \pi\right)}}{k}\\
\mathbf{elif}\;k \leq 1.9 \cdot 10^{+164}:\\
\;\;\;\;n \cdot \sqrt{2 \cdot \frac{\pi}{k \cdot n}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\pi + \pi\right) \cdot \frac{n}{\sqrt{k \cdot k}}}\\
\end{array}
\end{array}
if k < 2.7999999999999999e-31Initial program 99.4%
Applied rewrites99.4%
Applied rewrites99.3%
Taylor expanded in k around 0
Applied rewrites50.1%
if 2.7999999999999999e-31 < k < 1.90000000000000011e164Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Taylor expanded in n around inf
Applied rewrites50.4%
if 1.90000000000000011e164 < k Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Applied rewrites35.9%
(FPCore (k n)
:precision binary64
(if (<= k 2.8e-31)
(/ (sqrt (* (+ PI PI) n)) (sqrt k))
(if (<= k 1.9e+164)
(* n (sqrt (* 2.0 (/ PI (* k n)))))
(sqrt (* (+ PI PI) (/ n (sqrt (* k k))))))))
double code(double k, double n) {
double tmp;
if (k <= 2.8e-31) {
tmp = sqrt(((((double) M_PI) + ((double) M_PI)) * n)) / sqrt(k);
} else if (k <= 1.9e+164) {
tmp = n * sqrt((2.0 * (((double) M_PI) / (k * n))));
} else {
tmp = sqrt(((((double) M_PI) + ((double) M_PI)) * (n / sqrt((k * k)))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (k <= 2.8e-31) {
tmp = Math.sqrt(((Math.PI + Math.PI) * n)) / Math.sqrt(k);
} else if (k <= 1.9e+164) {
tmp = n * Math.sqrt((2.0 * (Math.PI / (k * n))));
} else {
tmp = Math.sqrt(((Math.PI + Math.PI) * (n / Math.sqrt((k * k)))));
}
return tmp;
}
def code(k, n): tmp = 0 if k <= 2.8e-31: tmp = math.sqrt(((math.pi + math.pi) * n)) / math.sqrt(k) elif k <= 1.9e+164: tmp = n * math.sqrt((2.0 * (math.pi / (k * n)))) else: tmp = math.sqrt(((math.pi + math.pi) * (n / math.sqrt((k * k))))) return tmp
function code(k, n) tmp = 0.0 if (k <= 2.8e-31) tmp = Float64(sqrt(Float64(Float64(pi + pi) * n)) / sqrt(k)); elseif (k <= 1.9e+164) tmp = Float64(n * sqrt(Float64(2.0 * Float64(pi / Float64(k * n))))); else tmp = sqrt(Float64(Float64(pi + pi) * Float64(n / sqrt(Float64(k * k))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (k <= 2.8e-31) tmp = sqrt(((pi + pi) * n)) / sqrt(k); elseif (k <= 1.9e+164) tmp = n * sqrt((2.0 * (pi / (k * n)))); else tmp = sqrt(((pi + pi) * (n / sqrt((k * k))))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[k, 2.8e-31], N[(N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.9e+164], N[(n * N[Sqrt[N[(2.0 * N[(Pi / N[(k * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * N[(n / N[Sqrt[N[(k * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{\sqrt{\left(\pi + \pi\right) \cdot n}}{\sqrt{k}}\\
\mathbf{elif}\;k \leq 1.9 \cdot 10^{+164}:\\
\;\;\;\;n \cdot \sqrt{2 \cdot \frac{\pi}{k \cdot n}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\pi + \pi\right) \cdot \frac{n}{\sqrt{k \cdot k}}}\\
\end{array}
\end{array}
if k < 2.7999999999999999e-31Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites50.2%
if 2.7999999999999999e-31 < k < 1.90000000000000011e164Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Taylor expanded in n around inf
Applied rewrites50.4%
if 1.90000000000000011e164 < k Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Applied rewrites35.9%
(FPCore (k n) :precision binary64 (if (<= n 3.2e-57) (sqrt (* (/ (+ n n) k) PI)) (* n (sqrt (* 2.0 (/ PI (* k n)))))))
double code(double k, double n) {
double tmp;
if (n <= 3.2e-57) {
tmp = sqrt((((n + n) / k) * ((double) M_PI)));
} else {
tmp = n * sqrt((2.0 * (((double) M_PI) / (k * n))));
}
return tmp;
}
public static double code(double k, double n) {
double tmp;
if (n <= 3.2e-57) {
tmp = Math.sqrt((((n + n) / k) * Math.PI));
} else {
tmp = n * Math.sqrt((2.0 * (Math.PI / (k * n))));
}
return tmp;
}
def code(k, n): tmp = 0 if n <= 3.2e-57: tmp = math.sqrt((((n + n) / k) * math.pi)) else: tmp = n * math.sqrt((2.0 * (math.pi / (k * n)))) return tmp
function code(k, n) tmp = 0.0 if (n <= 3.2e-57) tmp = sqrt(Float64(Float64(Float64(n + n) / k) * pi)); else tmp = Float64(n * sqrt(Float64(2.0 * Float64(pi / Float64(k * n))))); end return tmp end
function tmp_2 = code(k, n) tmp = 0.0; if (n <= 3.2e-57) tmp = sqrt((((n + n) / k) * pi)); else tmp = n * sqrt((2.0 * (pi / (k * n)))); end tmp_2 = tmp; end
code[k_, n_] := If[LessEqual[n, 3.2e-57], N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] / k), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision], N[(n * N[Sqrt[N[(2.0 * N[(Pi / N[(k * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 3.2 \cdot 10^{-57}:\\
\;\;\;\;\sqrt{\frac{n + n}{k} \cdot \pi}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \sqrt{2 \cdot \frac{\pi}{k \cdot n}}\\
\end{array}
\end{array}
if n < 3.2000000000000001e-57Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Applied rewrites38.2%
if 3.2000000000000001e-57 < n Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Taylor expanded in n around inf
Applied rewrites50.4%
(FPCore (k n) :precision binary64 (/ (sqrt (* (+ PI PI) n)) (sqrt k)))
double code(double k, double n) {
return sqrt(((((double) M_PI) + ((double) M_PI)) * n)) / sqrt(k);
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI + Math.PI) * n)) / Math.sqrt(k);
}
def code(k, n): return math.sqrt(((math.pi + math.pi) * n)) / math.sqrt(k)
function code(k, n) return Float64(sqrt(Float64(Float64(pi + pi) * n)) / sqrt(k)) end
function tmp = code(k, n) tmp = sqrt(((pi + pi) * n)) / sqrt(k); end
code[k_, n_] := N[(N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * n), $MachinePrecision]], $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt{\left(\pi + \pi\right) \cdot n}}{\sqrt{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites50.2%
(FPCore (k n) :precision binary64 (sqrt (* (/ (+ n n) k) PI)))
double code(double k, double n) {
return sqrt((((n + n) / k) * ((double) M_PI)));
}
public static double code(double k, double n) {
return Math.sqrt((((n + n) / k) * Math.PI));
}
def code(k, n): return math.sqrt((((n + n) / k) * math.pi))
function code(k, n) return sqrt(Float64(Float64(Float64(n + n) / k) * pi)) end
function tmp = code(k, n) tmp = sqrt((((n + n) / k) * pi)); end
code[k_, n_] := N[Sqrt[N[(N[(N[(n + n), $MachinePrecision] / k), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{n + n}{k} \cdot \pi}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
Applied rewrites38.2%
(FPCore (k n) :precision binary64 (sqrt (* (+ PI PI) (/ n k))))
double code(double k, double n) {
return sqrt(((((double) M_PI) + ((double) M_PI)) * (n / k)));
}
public static double code(double k, double n) {
return Math.sqrt(((Math.PI + Math.PI) * (n / k)));
}
def code(k, n): return math.sqrt(((math.pi + math.pi) * (n / k)))
function code(k, n) return sqrt(Float64(Float64(pi + pi) * Float64(n / k))) end
function tmp = code(k, n) tmp = sqrt(((pi + pi) * (n / k))); end
code[k_, n_] := N[Sqrt[N[(N[(Pi + Pi), $MachinePrecision] * N[(n / k), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(\pi + \pi\right) \cdot \frac{n}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
Applied rewrites50.2%
Applied rewrites38.2%
herbie shell --seed 2025161
(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))))