summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/math/fast_atan2f.cc
diff options
context:
space:
mode:
authoraiph <philipp.aigner@orderman.com>2014-11-21 15:10:30 +0100
committeraiph <philipp.aigner@orderman.com>2014-11-21 15:10:30 +0100
commitf863b5ced051105dc6379d4a7bb7b69821c5ad5b (patch)
treeb0c7ab0942691db0b1fee5daad3829fb86aca7ef /gnuradio-runtime/lib/math/fast_atan2f.cc
parenteee9ec984898cae90934881392fdc88da1d63ea8 (diff)
modified the qa tests to the correct values.
Diffstat (limited to 'gnuradio-runtime/lib/math/fast_atan2f.cc')
-rw-r--r--gnuradio-runtime/lib/math/fast_atan2f.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/gnuradio-runtime/lib/math/fast_atan2f.cc b/gnuradio-runtime/lib/math/fast_atan2f.cc
index d78ca5d84e..fbee832050 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)