Average Error: 0.5 → 0.7
Time: 7.4s
Precision: binary64
\[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
\[\left({n}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)} \cdot {\left(2 \cdot \pi\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}\right) \cdot \sqrt{\frac{1}{k}} \]
\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)}
\left({n}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)} \cdot {\left(2 \cdot \pi\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}\right) \cdot \sqrt{\frac{1}{k}}
(FPCore (k n)
 :precision binary64
 (* (/ 1.0 (sqrt k)) (pow (* (* 2.0 PI) n) (/ (- 1.0 k) 2.0))))
(FPCore (k n)
 :precision binary64
 (*
  (* (pow n (fma k -0.5 0.5)) (pow (* 2.0 PI) (fma k -0.5 0.5)))
  (sqrt (/ 1.0 k))))
double code(double k, double n) {
	return (1.0 / sqrt(k)) * pow(((2.0 * ((double) M_PI)) * n), ((1.0 - k) / 2.0));
}
double code(double k, double n) {
	return (pow(n, fma(k, -0.5, 0.5)) * pow((2.0 * ((double) M_PI)), fma(k, -0.5, 0.5))) * sqrt(1.0 / k);
}

Error

Bits error versus k

Bits error versus n

Derivation

  1. Initial program 0.5

    \[\frac{1}{\sqrt{k}} \cdot {\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\frac{1 - k}{2}\right)} \]
  2. Simplified0.5

    \[\leadsto \color{blue}{\frac{{\left(\left(2 \cdot \pi\right) \cdot n\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}}{\sqrt{k}}} \]
  3. Taylor expanded in n around 0 3.5

    \[\leadsto \color{blue}{\sqrt{\frac{1}{k}} \cdot e^{\left(\log n + \log \left(2 \cdot \pi\right)\right) \cdot \left(0.5 - 0.5 \cdot k\right)}} \]
  4. Simplified0.5

    \[\leadsto \color{blue}{{\left(n \cdot \left(2 \cdot \pi\right)\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)} \cdot \sqrt{\frac{1}{k}}} \]
  5. Applied unpow-prod-down_binary640.7

    \[\leadsto \color{blue}{\left({n}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)} \cdot {\left(2 \cdot \pi\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}\right)} \cdot \sqrt{\frac{1}{k}} \]
  6. Final simplification0.7

    \[\leadsto \left({n}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)} \cdot {\left(2 \cdot \pi\right)}^{\left(\mathsf{fma}\left(k, -0.5, 0.5\right)\right)}\right) \cdot \sqrt{\frac{1}{k}} \]

Reproduce

herbie shell --seed 2022095 
(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))))