
(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 9 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 (/ 1.0 k)) (pow (* (PI) (* n 2.0)) (fma -0.5 k 0.5))))
\begin{array}{l}
\\
\sqrt{\frac{1}{k}} \cdot {\left(\mathsf{PI}\left(\right) \cdot \left(n \cdot 2\right)\right)}^{\left(\mathsf{fma}\left(-0.5, k, 0.5\right)\right)}
\end{array}
Initial program 99.6%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (if (<= k 1.0) (/ (sqrt (* n 2.0)) (sqrt (/ k (PI)))) (/ (pow (* (* (PI) n) 2.0) (* -0.5 k)) (sqrt k))))
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;\frac{\sqrt{n \cdot 2}}{\sqrt{\frac{k}{\mathsf{PI}\left(\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot 2\right)}^{\left(-0.5 \cdot k\right)}}{\sqrt{k}}\\
\end{array}
\end{array}
if k < 1Initial program 99.2%
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.f6478.3
Applied rewrites78.3%
Applied rewrites78.4%
Applied rewrites99.2%
if 1 < k Initial program 100.0%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in k around inf
Applied rewrites100.0%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* (* (PI) n) 2.0) (fma k -0.5 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(\mathsf{PI}\left(\right) \cdot n\right) \cdot 2\right)}^{\left(\mathsf{fma}\left(k, -0.5, 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.6%
Applied rewrites99.6%
Applied rewrites99.6%
(FPCore (k n) :precision binary64 (/ (sqrt (* n 2.0)) (sqrt (/ k (PI)))))
\begin{array}{l}
\\
\frac{\sqrt{n \cdot 2}}{\sqrt{\frac{k}{\mathsf{PI}\left(\right)}}}
\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.f6442.4
Applied rewrites42.4%
Applied rewrites42.5%
Applied rewrites53.5%
Final simplification53.5%
(FPCore (k n) :precision binary64 (* (sqrt (* (PI) n)) (sqrt (/ 2.0 k))))
\begin{array}{l}
\\
\sqrt{\mathsf{PI}\left(\right) \cdot n} \cdot \sqrt{\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.f6442.4
Applied rewrites42.4%
Applied rewrites42.5%
Applied rewrites53.5%
Final simplification53.5%
(FPCore (k n) :precision binary64 (* (sqrt n) (sqrt (* (/ (PI) k) 2.0))))
\begin{array}{l}
\\
\sqrt{n} \cdot \sqrt{\frac{\mathsf{PI}\left(\right)}{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.f6442.4
Applied rewrites42.4%
Applied rewrites42.5%
Applied rewrites53.2%
Final simplification53.2%
(FPCore (k n) :precision binary64 (sqrt (* (* (/ (PI) k) n) 2.0)))
\begin{array}{l}
\\
\sqrt{\left(\frac{\mathsf{PI}\left(\right)}{k} \cdot n\right) \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.f6442.4
Applied rewrites42.4%
Applied rewrites42.5%
Applied rewrites42.5%
(FPCore (k n) :precision binary64 (sqrt (* (* (/ 2.0 k) (PI)) n)))
\begin{array}{l}
\\
\sqrt{\left(\frac{2}{k} \cdot \mathsf{PI}\left(\right)\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.f6442.4
Applied rewrites42.4%
Applied rewrites42.5%
Applied rewrites42.5%
Applied rewrites42.5%
(FPCore (k n) :precision binary64 (sqrt (* (/ 2.0 k) (* (PI) n))))
\begin{array}{l}
\\
\sqrt{\frac{2}{k} \cdot \left(\mathsf{PI}\left(\right) \cdot n\right)}
\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.f6442.4
Applied rewrites42.4%
Applied rewrites42.5%
Applied rewrites42.5%
Final simplification42.5%
herbie shell --seed 2024284
(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))))