diff options
author | Nathan West <nathan.west@okstate.edu> | 2013-11-06 05:43:27 -0600 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2013-11-06 09:16:02 -0800 |
commit | 59ab46d521d11b9ad14da5221cb7fa269ab9dea7 (patch) | |
tree | fd2db33d1da5c3416d12d4c2dfae1c567c131c41 /gnuradio-runtime/lib/math/qa_fast_atan2f.cc | |
parent | 311b871d33494e380cd9b03de7841a2080f67bde (diff) |
runtime: add qa for fast_atan2f, removed a float equality test
Diffstat (limited to 'gnuradio-runtime/lib/math/qa_fast_atan2f.cc')
-rw-r--r-- | gnuradio-runtime/lib/math/qa_fast_atan2f.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gnuradio-runtime/lib/math/qa_fast_atan2f.cc b/gnuradio-runtime/lib/math/qa_fast_atan2f.cc new file mode 100644 index 0000000000..119fb8fe77 --- /dev/null +++ b/gnuradio-runtime/lib/math/qa_fast_atan2f.cc @@ -0,0 +1,51 @@ +/* -*- c++ -*- */ +/* + * Copyright 2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qa_fast_atan2f.h> +#include <gnuradio/math.h> +#include <cppunit/TestAssert.h> +#include <cmath> + +void +qa_fast_atan2f::t1() +{ + static const unsigned int N = 100; + float c_atan2; + float gr_atan2f; + + for(float i = -N/2; i < N/2; i++) { + for(float j =-N/2; i < N/2; i++) { + float x = i/10.0; + float y = j/10.0; + c_atan2 = atan2(x, y); + + gr_atan2f = gr::fast_atan2f(x, y); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.0001); + } + } +} + |