added 1/sqrt(2) constant

This commit is contained in:
Ahmet Inan 2019-01-15 22:22:09 +01:00
commit 5462e20751
2 changed files with 2 additions and 1 deletions

View file

@ -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
};
}

2
fft.hh
View file

@ -15,7 +15,7 @@ namespace FFT {
template <typename TYPE>
static inline TYPE rsqrt2(TYPE a)
{
return (std::sqrt(typename TYPE::value_type(2)) / typename TYPE::value_type(2)) * a;
return Const<TYPE>::InvSqrtTwo() * a;
}
template <typename TYPE>