
(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 7 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 (let* ((t_0 (* (* 2.0 (PI)) n))) (/ (sqrt t_0) (sqrt (* k (pow t_0 k))))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\\
\frac{\sqrt{t\_0}}{\sqrt{k \cdot {t\_0}^{k}}}
\end{array}
\end{array}
Initial program 99.5%
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
*-commutativeN/A
lower-*.f6499.7
lift-*.f64N/A
*-commutativeN/A
lift-*.f6499.7
lift-*.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-*.f64N/A
*-commutativeN/A
lift-*.f6499.7
Applied rewrites99.7%
(FPCore (k n) :precision binary64 (let* ((t_0 (* 2.0 (PI)))) (* (sqrt n) (sqrt (/ t_0 (* k (pow (* t_0 n) k)))))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \mathsf{PI}\left(\right)\\
\sqrt{n} \cdot \sqrt{\frac{t\_0}{k \cdot {\left(t\_0 \cdot n\right)}^{k}}}
\end{array}
\end{array}
Initial program 99.5%
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
pow1/2N/A
lift-*.f64N/A
unpow-prod-downN/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
unpow1/2N/A
sqrt-unprodN/A
sqrt-undivN/A
Applied rewrites99.7%
(FPCore (k n)
:precision binary64
(let* ((t_0 (* 2.0 (PI))))
(if (<= k 1.0)
(* (sqrt n) (sqrt (/ t_0 k)))
(/ (pow (* t_0 n) (* -0.5 k)) (sqrt k)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;k \leq 1:\\
\;\;\;\;\sqrt{n} \cdot \sqrt{\frac{t\_0}{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(t\_0 \cdot n\right)}^{\left(-0.5 \cdot k\right)}}{\sqrt{k}}\\
\end{array}
\end{array}
if k < 1Initial program 98.9%
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.f6474.2
Applied rewrites74.2%
Applied rewrites95.5%
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
Applied rewrites100.0%
(FPCore (k n) :precision binary64 (/ (pow (* (* 2.0 (PI)) n) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\mathsf{fma}\left(-0.5, k, 0.5\right)\right)}}{\sqrt{k}}
\end{array}
Initial program 99.5%
Taylor expanded in k around inf
lower-*.f6456.9
Applied rewrites56.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6456.9
Applied rewrites56.9%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
(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.5%
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.f6436.0
Applied rewrites36.0%
Applied rewrites45.9%
(FPCore (k n) :precision binary64 (sqrt (* (* (/ n k) (PI)) 2.0)))
\begin{array}{l}
\\
\sqrt{\left(\frac{n}{k} \cdot \mathsf{PI}\left(\right)\right) \cdot 2}
\end{array}
Initial program 99.5%
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.f6436.0
Applied rewrites36.0%
Applied rewrites36.1%
Applied rewrites36.1%
(FPCore (k n) :precision binary64 (sqrt (* (* n (/ (PI) k)) 2.0)))
\begin{array}{l}
\\
\sqrt{\left(n \cdot \frac{\mathsf{PI}\left(\right)}{k}\right) \cdot 2}
\end{array}
Initial program 99.5%
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.f6436.0
Applied rewrites36.0%
Applied rewrites36.1%
Applied rewrites36.1%
herbie shell --seed 2024321
(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))))