diff --git a/const.hh b/const.hh index ab4acdc..342fd0b 100644 --- a/const.hh +++ b/const.hh @@ -19,6 +19,7 @@ struct Const { static constexpr T FourPi() { return 12.56637061435917295385; } // 16*a(1) static constexpr T SqrtPi() { return 1.77245385090551602730; } // sqrt(4*a(1)) static constexpr T SqrtTwoPi() { return 2.50662827463100050242; } // sqrt(8*a(1)) + static constexpr T InvSqrtTwo() { return 0.70710678118654752440; } // sqrt(2)/2 }; } diff --git a/fft.hh b/fft.hh index 0110bdd..e3643a1 100644 --- a/fft.hh +++ b/fft.hh @@ -15,7 +15,7 @@ namespace FFT { template static inline TYPE rsqrt2(TYPE a) { - return (std::sqrt(typename TYPE::value_type(2)) / typename TYPE::value_type(2)) * a; + return Const::InvSqrtTwo() * a; } template