mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 22:35:45 +00:00
added 1/sqrt(2) constant
This commit is contained in:
parent
00501fa433
commit
5462e20751
2 changed files with 2 additions and 1 deletions
1
const.hh
1
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
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
2
fft.hh
2
fft.hh
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue