
(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 4 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 (/ (pow (* (+ n n) (PI)) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(n + 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.1%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.1%
lift-*.f64N/A
*-lft-identity99.1
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6499.1
Applied rewrites99.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6499.1
Applied rewrites99.1%
(FPCore (k n) :precision binary64 (* (sqrt (* (/ (PI) k) 2.0)) (sqrt n)))
\begin{array}{l}
\\
\sqrt{\frac{\mathsf{PI}\left(\right)}{k} \cdot 2} \cdot \sqrt{n}
\end{array}
Initial program 99.1%
lift-pow.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift--.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
lift--.f6479.8
Applied rewrites79.8%
Taylor expanded in k around 0
lower-sqrt.f6478.8
Applied rewrites78.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.8%
Taylor expanded in k around 0
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f6455.0
Applied rewrites55.0%
(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.1%
Taylor expanded in k around 0
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6441.4
Applied rewrites41.4%
lift-/.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f6441.4
Applied rewrites41.4%
(FPCore (k n) :precision binary64 (sqrt (* (PI) (* (/ n k) 2.0))))
\begin{array}{l}
\\
\sqrt{\mathsf{PI}\left(\right) \cdot \left(\frac{n}{k} \cdot 2\right)}
\end{array}
Initial program 99.1%
Taylor expanded in k around 0
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6441.4
Applied rewrites41.4%
lift-/.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f6441.4
Applied rewrites41.4%
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-*.f6441.4
Applied rewrites41.4%
herbie shell --seed 2025043
(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))))