
(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 8 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 2.0) (PI)) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(n \cdot 2\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.6%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Applied rewrites99.7%
(FPCore (k n) :precision binary64 (/ (sqrt (* (* n 2.0) (PI))) (sqrt k)))
\begin{array}{l}
\\
\frac{\sqrt{\left(n \cdot 2\right) \cdot \mathsf{PI}\left(\right)}}{\sqrt{k}}
\end{array}
Initial program 99.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.f6436.4
Applied rewrites36.4%
Applied rewrites46.4%
(FPCore (k n) :precision binary64 (/ (sqrt (* (PI) n)) (sqrt (* 0.5 k))))
\begin{array}{l}
\\
\frac{\sqrt{\mathsf{PI}\left(\right) \cdot n}}{\sqrt{0.5 \cdot k}}
\end{array}
Initial program 99.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.f6436.4
Applied rewrites36.4%
Applied rewrites36.5%
Applied rewrites36.5%
Applied rewrites46.4%
(FPCore (k n) :precision binary64 (* (sqrt (/ (PI) k)) (sqrt (* n 2.0))))
\begin{array}{l}
\\
\sqrt{\frac{\mathsf{PI}\left(\right)}{k}} \cdot \sqrt{n \cdot 2}
\end{array}
Initial program 99.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.f6436.4
Applied rewrites36.4%
Applied rewrites36.5%
Applied rewrites46.4%
(FPCore (k n) :precision binary64 (* (sqrt (/ 2.0 k)) (sqrt (* (PI) n))))
\begin{array}{l}
\\
\sqrt{\frac{2}{k}} \cdot \sqrt{\mathsf{PI}\left(\right) \cdot n}
\end{array}
Initial program 99.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.f6436.4
Applied rewrites36.4%
Applied rewrites36.5%
Applied rewrites46.3%
(FPCore (k n) :precision binary64 (* (sqrt (* 2.0 (/ (PI) k))) (sqrt n)))
\begin{array}{l}
\\
\sqrt{2 \cdot \frac{\mathsf{PI}\left(\right)}{k}} \cdot \sqrt{n}
\end{array}
Initial program 99.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.f6436.4
Applied rewrites36.4%
Applied rewrites36.5%
Applied rewrites46.3%
(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.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.f6436.4
Applied rewrites36.4%
Applied rewrites36.5%
(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.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.f6436.4
Applied rewrites36.4%
Applied rewrites36.5%
Applied rewrites36.5%
herbie shell --seed 2024307
(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))))