commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/13: modified the qa tests to the correct


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/13: modified the qa tests to the correct values.
Date: Thu, 4 Dec 2014 16:21:49 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch maint
in repository gnuradio.

commit f863b5ced051105dc6379d4a7bb7b69821c5ad5b
Author: aiph <address@hidden>
Date:   Fri Nov 21 15:10:30 2014 +0100

    modified the qa tests to the correct values.
---
 gnuradio-runtime/lib/math/fast_atan2f.cc    | 16 +++++++--
 gnuradio-runtime/lib/math/qa_fast_atan2f.cc | 56 +++++++++++++++--------------
 2 files changed, 43 insertions(+), 29 deletions(-)

diff --git a/gnuradio-runtime/lib/math/fast_atan2f.cc 
b/gnuradio-runtime/lib/math/fast_atan2f.cc
index d78ca5d..fbee832 100644
--- a/gnuradio-runtime/lib/math/fast_atan2f.cc
+++ b/gnuradio-runtime/lib/math/fast_atan2f.cc
@@ -132,15 +132,25 @@ namespace gr {
     y_abs = fabsf(y);
     x_abs = fabsf(x);
     /* don't divide by zero! */
-    if(!((y_abs > 0.0f) || (x_abs > 0.0f)))
-      return 0.0;
+       if ((x_abs == 0.0) && (y_abs == 0.0))
+               return 0.0;
+
+       /* check if one of the both is NaN */
+       if (isnan(y_abs))
+               return y;
+       
+       if (isnan(x_abs))
+               return x;
 
-    //z = (y_abs < x_abs ? y_abs / x_abs : x_abs / y_abs);
     if(y_abs < x_abs)
       z = y_abs / x_abs;
     else
       z = x_abs / y_abs;
 
+       /* check if z is NaN */
+       if (isnan(z))
+               return z;
+
     /* when ratio approaches the table resolution, the angle is */
     /* best approximated with the argument itself... */
     if(z < TAN_MAP_RES)
diff --git a/gnuradio-runtime/lib/math/qa_fast_atan2f.cc 
b/gnuradio-runtime/lib/math/qa_fast_atan2f.cc
index b704756..1d1cea0 100644
--- a/gnuradio-runtime/lib/math/qa_fast_atan2f.cc
+++ b/gnuradio-runtime/lib/math/qa_fast_atan2f.cc
@@ -47,11 +47,11 @@ qa_fast_atan2f::t1()
     for(float j =-N/2; i < N/2; i++) {
       float x = i/10.0;
       float y = j/10.0;
-      c_atan2 = atan2(x, y);
+      c_atan2 = atan2(y, x);
 
-      gr_atan2f = gr::fast_atan2f(x, y);
+      gr_atan2f = gr::fast_atan2f(y, x);
 
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.0001);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f,0.000083);
     }
   }
 }
@@ -69,71 +69,75 @@ qa_fast_atan2f::t2()
   /* Test x as INF */
   x = inf;
   y = 0;
-  c_atan2 = atan2(x, y);
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.00083);
 
   x = -inf;
   y = 0;
-  c_atan2 = atan2(x, y);
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.00083);
 
 
   /* Test y as INF */
   x = 0;
   y = inf;
-  c_atan2 = atan2(x, y);
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.00083);
 
   x = 0;
   y = -inf;
-  c_atan2 = atan2(x, y);
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(c_atan2, gr_atan2f, 0.00083);
 
 
   /* Test x and y as INF */
   x = inf;
   y = inf;
-  gr_atan2f = gr::fast_atan2f(x, y);
+  gr_atan2f = gr::fast_atan2f(y, x);
   CPPUNIT_ASSERT(isnan(gr_atan2f));
 
 
   /* Test x as NAN */
   x = nan;
   y = 0;
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT(isnan(gr_atan2f));
 
   x = -nan;
   y = 0;
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT(isnan(gr_atan2f));
 
 
   /* Test y as NAN */
   x = 0;
   y = nan;
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT(isnan(gr_atan2f));
 
   x = 0;
   y = -nan;
-  gr_atan2f = gr::fast_atan2f(x, y);
-  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0f, gr_atan2f, 0.0001);
+  c_atan2 = atan2(y, x);
+  gr_atan2f = gr::fast_atan2f(y, x);
+  CPPUNIT_ASSERT(isnan(gr_atan2f));
 
 
   /* Test mixed NAN and INF */
   x = inf;
   y = nan;
-  gr_atan2f = gr::fast_atan2f(x, y);
+  gr_atan2f = gr::fast_atan2f(y, x);
   CPPUNIT_ASSERT(isnan(gr_atan2f));
 
   x = nan;
   y = inf;
-  gr_atan2f = gr::fast_atan2f(x, y);
+  gr_atan2f = gr::fast_atan2f(y, x);
   CPPUNIT_ASSERT(isnan(gr_atan2f));
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]