
(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 (let* ((t_0 (* n (* (PI) 2.0)))) (* (pow (sqrt k) -1.0) (* (pow t_0 (* k -0.5)) (sqrt t_0)))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(\mathsf{PI}\left(\right) \cdot 2\right)\\
{\left(\sqrt{k}\right)}^{-1} \cdot \left({t\_0}^{\left(k \cdot -0.5\right)} \cdot \sqrt{t\_0}\right)
\end{array}
\end{array}
Initial program 99.6%
lift-pow.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
metadata-evalN/A
sub-negN/A
+-commutativeN/A
unpow-prod-upN/A
lower-*.f64N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (k n) :precision binary64 (* (pow (* (* 2.0 n) (PI)) (fma -0.5 k 0.5)) (sqrt (pow k -1.0))))
\begin{array}{l}
\\
{\left(\left(2 \cdot n\right) \cdot \mathsf{PI}\left(\right)\right)}^{\left(\mathsf{fma}\left(-0.5, k, 0.5\right)\right)} \cdot \sqrt{{k}^{-1}}
\end{array}
Initial program 99.6%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.6%
Final simplification99.6%
(FPCore (k n) :precision binary64 (/ (pow (* (* 2.0 (PI)) n) (fma -0.5 k 0.5)) (sqrt k)))
\begin{array}{l}
\\
\frac{{\left(\left(2 \cdot \mathsf{PI}\left(\right)\right) \cdot n\right)}^{\left(\mathsf{fma}\left(-0.5, k, 0.5\right)\right)}}{\sqrt{k}}
\end{array}
Initial program 99.6%
lift-pow.f64N/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
metadata-evalN/A
sub-negN/A
+-commutativeN/A
unpow-prod-upN/A
lower-*.f64N/A
Applied rewrites99.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6499.7
Applied rewrites99.6%
(FPCore (k n) :precision binary64 (* (sqrt (* (/ 2.0 k) (PI))) (sqrt n)))
\begin{array}{l}
\\
\sqrt{\frac{2}{k} \cdot \mathsf{PI}\left(\right)} \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.f6435.6
Applied rewrites35.6%
Applied rewrites35.8%
Applied rewrites35.7%
Applied rewrites48.0%
(FPCore (k n) :precision binary64 (sqrt (/ (* (* 2.0 (PI)) n) k)))
\begin{array}{l}
\\
\sqrt{\frac{\left(2 \cdot \mathsf{PI}\left(\right)\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.f6435.6
Applied rewrites35.6%
Applied rewrites35.8%
(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.f6435.6
Applied rewrites35.6%
Applied rewrites35.8%
Applied rewrites35.7%
(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.f6435.6
Applied rewrites35.6%
Applied rewrites35.8%
Applied rewrites35.7%
Applied rewrites35.7%
herbie shell --seed 2024315
(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))))