diff src/OPERATORS/op-cs-cs.cc @ 9551:19d298e6f7e5

make ! operator check for NaNs, simplify implementations in liboctave
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 21 Aug 2009 08:18:16 +0200
parents eb63fbe60fab
children 42a18d5aff7f
line wrap: on
line diff
--- a/src/OPERATORS/op-cs-cs.cc
+++ b/src/OPERATORS/op-cs-cs.cc
@@ -25,6 +25,8 @@
 #include <config.h>
 #endif
 
+#include "Array-util.h"
+
 #include "gripes.h"
 #include "oct-obj.h"
 #include "ov.h"
@@ -42,8 +44,10 @@
 DEFUNOP (not, complex)
 {
   CAST_UNOP_ARG (const octave_complex&);
-
-  return octave_value (v.complex_value () == 0.0);
+  Complex x = v.complex_value ();
+  if (xisnan (x))
+    gripe_nan_to_logical_conversion ();
+  return octave_value (x == 0.0);
 }
 
 DEFUNOP_OP (uplus, complex, /* no-op */)