
(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 6 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 (pow k -1.0)) (pow (* (* 2.0 (PI)) n) (/ (- 1.0 k) 2.0))))
\begin{array}{l}
\\
\sqrt{{k}^{-1}} \cdot {\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\end{array}
Initial program 98.9%
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f6499.0
Applied rewrites99.0%
(FPCore (k n) :precision binary64 (/ (pow (* n (+ (PI) (PI))) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(n \cdot \left(\mathsf{PI}\left(\right) + \mathsf{PI}\left(\right)\right)\right)}^{\left(\mathsf{fma}\left(-0.5, k, 0.5\right)\right)}}{\sqrt{k}}
\end{array}
Initial program 98.9%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6498.9
Applied rewrites98.9%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-sqrt.f6498.9
Applied rewrites98.9%
lift-*.f64N/A
*-lft-identity98.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
lift-PI.f64N/A
lift-PI.f6498.9
Applied rewrites98.9%
(FPCore (k n) :precision binary64 (* (sqrt (pow k -1.0)) (sqrt (* (* (PI) 2.0) n))))
\begin{array}{l}
\\
\sqrt{{k}^{-1}} \cdot \sqrt{\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n}
\end{array}
Initial program 98.9%
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f6499.0
Applied rewrites99.0%
Taylor expanded in k around 0
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
exp-to-powN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
sqrt-unprodN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
Applied rewrites51.2%
(FPCore (k n) :precision binary64 (/ (sqrt (* n (* (PI) 2.0))) (sqrt k)))
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)}}{\sqrt{k}}
\end{array}
Initial program 98.9%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6498.9
Applied rewrites98.9%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-sqrt.f6498.9
Applied rewrites98.9%
Taylor expanded in k around 0
*-lft-identityN/A
sqrt-unprodN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-sqrt.f6451.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.1
Applied rewrites51.1%
Final simplification51.1%
(FPCore (k n) :precision binary64 (sqrt (* (* (PI) (/ n k)) 2.0)))
\begin{array}{l}
\\
\sqrt{\left(\mathsf{PI}\left(\right) \cdot \frac{n}{k}\right) \cdot 2}
\end{array}
Initial program 98.9%
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.f6435.5
Applied rewrites35.5%
lift-/.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-PI.f64N/A
lower-/.f6435.5
Applied rewrites35.5%
(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 98.9%
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.f6435.5
Applied rewrites35.5%
lift-/.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-PI.f6435.5
Applied rewrites35.5%
herbie shell --seed 2025037
(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))))