
(FPCore (k n) :precision binary64 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 (PI)) n) (/ (- 1.0 k) 2.0))))
\begin{array}{l}
\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\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))))
\begin{array}{l}
\\
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (/ (* 2.0 (PI)) (* k (pow (* (* 2.0 n) (PI)) k))))))
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{\frac{2 \cdot \mathsf{PI}\left(\right)}{k \cdot {\left(\left(2 \cdot n\right) \cdot \mathsf{PI}\left(\right)\right)}^{k}}}
\end{array}
Initial program 99.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lift-pow.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
metadata-evalN/A
pow-subN/A
associate-/l/N/A
lower-/.f64N/A
Applied rewrites99.7%
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
pow1/2N/A
associate-/l*N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
Applied rewrites99.7%
(FPCore (k n) :precision binary64 (if (<= k 1.0) (/ (sqrt (* (PI) n)) (sqrt (* k 0.5))) (/ (pow (* (* 2.0 n) (PI)) (* -0.5 k)) (sqrt k))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;\frac{\sqrt{\mathsf{PI}\left(\right) \cdot n}}{\sqrt{k \cdot 0.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\left(2 \cdot n\right) \cdot \mathsf{PI}\left(\right)\right)}^{\left(-0.5 \cdot k\right)}}{\sqrt{k}}\\
\end{array}
\end{array}
if k < 1Initial program 98.6%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6472.5
Applied rewrites72.5%
Applied rewrites72.8%
Applied rewrites94.7%
if 1 < k Initial program 100.0%
Taylor expanded in k around inf
lower-*.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f64100.0
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64100.0
Applied rewrites100.0%
(FPCore (k n) :precision binary64 (/ (pow (* (* 2.0 n) (PI)) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(2 \cdot n\right) \cdot \mathsf{PI}\left(\right)\right)}^{\left(\mathsf{fma}\left(-0.5, k, 0.5\right)\right)}}{\sqrt{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around inf
lower-*.f6456.5
Applied rewrites56.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6456.5
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6456.5
Applied rewrites56.5%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6499.4
Applied rewrites99.4%
(FPCore (k n) :precision binary64 (/ (sqrt (* (PI) n)) (sqrt (* k 0.5))))
\begin{array}{l}
\\
\frac{\sqrt{\mathsf{PI}\left(\right) \cdot n}}{\sqrt{k \cdot 0.5}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites35.2%
Applied rewrites45.4%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 n)) (sqrt (/ (PI) k))))
\begin{array}{l}
\\
\sqrt{2 \cdot n} \cdot \sqrt{\frac{\mathsf{PI}\left(\right)}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites35.2%
Applied rewrites45.4%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (/ (* 2.0 (PI)) k))))
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{\frac{2 \cdot \mathsf{PI}\left(\right)}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites45.4%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* (PI) (/ 2.0 k)))))
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{\mathsf{PI}\left(\right) \cdot \frac{2}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites35.2%
Applied rewrites45.4%
(FPCore (k n) :precision binary64 (sqrt (* (/ (* (PI) n) k) 2.0)))
\begin{array}{l}
\\
\sqrt{\frac{\mathsf{PI}\left(\right) \cdot n}{k} \cdot 2}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites35.2%
(FPCore (k n) :precision binary64 (sqrt (* (* (PI) n) (/ 2.0 k))))
\begin{array}{l}
\\
\sqrt{\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot \frac{2}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites35.2%
Applied rewrites35.2%
(FPCore (k n) :precision binary64 (sqrt (* (PI) (/ (* 2.0 n) k))))
\begin{array}{l}
\\
\sqrt{\mathsf{PI}\left(\right) \cdot \frac{2 \cdot n}{k}}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites35.2%
Applied rewrites35.2%
(FPCore (k n) :precision binary64 (sqrt (* n (* (PI) (/ 2.0 k)))))
\begin{array}{l}
\\
\sqrt{n \cdot \left(\mathsf{PI}\left(\right) \cdot \frac{2}{k}\right)}
\end{array}
Initial program 99.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6435.1
Applied rewrites35.1%
Applied rewrites35.2%
Applied rewrites35.2%
herbie shell --seed 2024323
(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))))