make it work for negative n too

This commit is contained in:
Ahmet Inan 2019-01-18 22:21:51 +01:00
commit cf54a8e431
2 changed files with 9 additions and 1 deletions

View file

@ -15,7 +15,7 @@ template <typename TYPE, typename PRECISE>
void test(int MAX)
{
for (int N = 1; N <= MAX; ++N) {
for (int n = 0; n < N; ++n) {
for (int n = -N; n <= N; ++n) {
PRECISE x = DSP::Const<PRECISE>::TwoPi() * PRECISE(n) / PRECISE(N);
PRECISE cos_err = std::abs(DSP::UnitCircle<TYPE>::cos(n, N) - std::cos(x));
assert(cos_err < std::numeric_limits<TYPE>::epsilon());