
(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 (/ (pow (* n (* 2.0 (PI))) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(n \cdot \left(2 \cdot \mathsf{PI}\left(\right)\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
*-commutativeN/A
lower-*.f6454.7
Applied rewrites54.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6454.7
lift-*.f64N/A
*-commutativeN/A
lift-*.f6454.7
Applied rewrites54.7%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (k n) :precision binary64 (let* ((t_0 (* n (* 2.0 (PI))))) (if (<= k 1.0) (/ (sqrt t_0) (sqrt k)) (/ (pow t_0 (* -0.5 k)) (sqrt k)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)\\
\mathbf{if}\;k \leq 1:\\
\;\;\;\;\frac{\sqrt{t\_0}}{\sqrt{k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{t\_0}^{\left(-0.5 \cdot k\right)}}{\sqrt{k}}\\
\end{array}
\end{array}
if k < 1Initial program 98.8%
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.f6468.0
Applied rewrites68.0%
Applied rewrites95.7%
if 1 < k Initial program 100.0%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6498.6
lift-*.f64N/A
*-commutativeN/A
lift-*.f6498.6
Applied rewrites98.6%
Final simplification97.2%
(FPCore (k n) :precision binary64 (/ (sqrt (* n (* 2.0 (PI)))) (sqrt k)))
\begin{array}{l}
\\
\frac{\sqrt{n \cdot \left(2 \cdot \mathsf{PI}\left(\right)\right)}}{\sqrt{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.f6434.0
Applied rewrites34.0%
Applied rewrites47.4%
Final simplification47.4%
(FPCore (k n) :precision binary64 (* (sqrt (/ 2.0 k)) (sqrt (* n (PI)))))
\begin{array}{l}
\\
\sqrt{\frac{2}{k}} \cdot \sqrt{n \cdot \mathsf{PI}\left(\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.f6434.0
Applied rewrites34.0%
Applied rewrites34.2%
Applied rewrites47.4%
Final simplification47.4%
(FPCore (k n) :precision binary64 (* (sqrt (/ (* 2.0 (PI)) k)) (sqrt n)))
\begin{array}{l}
\\
\sqrt{\frac{2 \cdot \mathsf{PI}\left(\right)}{k}} \cdot \sqrt{n}
\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.f6434.0
Applied rewrites34.0%
Applied rewrites47.3%
Final simplification47.3%
(FPCore (k n) :precision binary64 (sqrt (/ (* n 2.0) (/ k (PI)))))
\begin{array}{l}
\\
\sqrt{\frac{n \cdot 2}{\frac{k}{\mathsf{PI}\left(\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.f6434.0
Applied rewrites34.0%
Applied rewrites34.2%
Applied rewrites34.2%
(FPCore (k n) :precision binary64 (sqrt (* (* (/ 2.0 k) n) (PI))))
\begin{array}{l}
\\
\sqrt{\left(\frac{2}{k} \cdot n\right) \cdot \mathsf{PI}\left(\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.f6434.0
Applied rewrites34.0%
Applied rewrites34.2%
Applied rewrites34.2%
Applied rewrites34.2%
herbie shell --seed 2024255
(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))))