
(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 (/ (pow (* (* (PI) 2.0) n) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n\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.6%
(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.f6438.3
Applied rewrites38.3%
Applied rewrites38.5%
Applied rewrites50.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.f6438.3
Applied rewrites38.3%
Applied rewrites38.5%
Applied rewrites50.4%
Final simplification50.4%
(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.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.f6438.3
Applied rewrites38.3%
Applied rewrites38.5%
Applied rewrites50.0%
Final simplification50.0%
(FPCore (k n) :precision binary64 (sqrt (/ (* (* (PI) 2.0) n) k)))
\begin{array}{l}
\\
\sqrt{\frac{\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot n}{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.f6438.3
Applied rewrites38.3%
Applied rewrites38.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.f6438.3
Applied rewrites38.3%
Applied rewrites38.5%
Applied rewrites38.4%
Final simplification38.4%
(FPCore (k n) :precision binary64 (sqrt (* (* (/ (PI) k) 2.0) n)))
\begin{array}{l}
\\
\sqrt{\left(\frac{\mathsf{PI}\left(\right)}{k} \cdot 2\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.f6438.3
Applied rewrites38.3%
Applied rewrites38.5%
Applied rewrites38.1%
Final simplification38.1%
(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.f6438.3
Applied rewrites38.3%
Applied rewrites38.5%
Applied rewrites38.1%
Applied rewrites38.0%
Final simplification38.0%
herbie shell --seed 2024276
(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))))