autotest: checking real, imag components on isnan to avoid errors on certain compilers
@@ -116,6 +116,9 @@ void liquid_autotest_print_array(unsigned char * _x,
// Compute magnitude of (possibly) complex number
#define LIQUID_AUTOTEST_VMAG(V) (sqrt(creal(V)*creal(V)+cimag(V)*cimag(V)))
+// Compute isnan on (possibly) complex number
+#define LIQUID_AUTOTEST_ISNAN(V) (isnan(crealf(V)) || isnan(cimagf(V)))
+
// CONTEND_EQUALITY
#define TEST_EQUALITY(F,L,EX,X,EY,Y) \
{ \
@@ -174,7 +177,8 @@ void liquid_autotest_print_array(unsigned char * _x,
// as well as complex numbers
#define TEST_DELTA(F,L,EX,X,EY,Y,ED,D) \
{ \
- if (LIQUID_AUTOTEST_VMAG((X)-(Y)) > (D) || isnan((X)) || isnan((Y))) \
+ if (LIQUID_AUTOTEST_VMAG((X)-(Y)) > (D) || \
+ LIQUID_AUTOTEST_ISNAN((X)) || LIQUID_AUTOTEST_ISNAN((Y)) ) \
{ \
liquid_autotest_failed_expr(F,L,"abs(" #X "-" #Y ")", \
LIQUID_AUTOTEST_VMAG((X)-(Y)),"<",ED,D); \
