Mercurial > hg > octave-nkf
diff src/OPERATORS/op-fs-fs.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 | ac4b97c6bf8b |
line wrap: on
line diff
--- a/src/OPERATORS/op-fs-fs.cc +++ b/src/OPERATORS/op-fs-fs.cc @@ -25,6 +25,8 @@ #include <config.h> #endif +#include "Array-util.h" + #include "gripes.h" #include "oct-obj.h" #include "ov.h" @@ -39,7 +41,15 @@ // scalar unary ops. -DEFUNOP_OP (not, float_scalar, !) +DEFUNOP (not, float_scalar) +{ + CAST_UNOP_ARG (const octave_float_scalar&); + float x = v.float_value (); + if (xisnan (x)) + gripe_nan_to_logical_conversion (); + return octave_value (x == 0.0f); +} + DEFUNOP_OP (uplus, float_scalar, /* no-op */) DEFUNOP_OP (uminus, float_scalar, -) DEFUNOP_OP (transpose, float_scalar, /* no-op */)