Mercurial > hg > octave-lojdl
changeset 9579:42a18d5aff7f
make complex scalar cmp ops consistent
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 27 Aug 2009 11:58:11 +0200 |
parents | 7dafdb8b062f |
children | 8bf27324a9d0 |
files | src/ChangeLog src/OPERATORS/op-cs-cs.cc src/OPERATORS/op-fcs-fcs.cc |
diffstat | 3 files changed, 17 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-08-27 Jaroslav Hajek <highegg@gmail.com> + + * OPERATORS/op-cs-cs.cc: Simplify comparison operators. + * OPERATORS/op-fcs-fcs.cc: Ditto. + 2009-08-25 David Grundberg <individ@acc.umu.se> * DLD-FUNCTIONS/__magick_read__.cc [HAVE_MAGICK]: Include
--- a/src/OPERATORS/op-cs-cs.cc +++ b/src/OPERATORS/op-cs-cs.cc @@ -96,47 +96,12 @@ return octave_value (v2.complex_value () / d); } -DEFBINOP (lt, complex, complex) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_complex&); - - return real (v1.complex_value ()) < real (v2.complex_value ()); -} - -DEFBINOP (le, complex, complex) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_complex&); - - return real (v1.complex_value ()) <= real (v2.complex_value ()); -} - -DEFBINOP (eq, complex, complex) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_complex&); - - return v1.complex_value () == v2.complex_value (); -} - -DEFBINOP (ge, complex, complex) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_complex&); - - return real (v1.complex_value ()) >= real (v2.complex_value ()); -} - -DEFBINOP (gt, complex, complex) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_complex&); - - return real (v1.complex_value ()) > real (v2.complex_value ()); -} - -DEFBINOP (ne, complex, complex) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_complex&); - - return v1.complex_value () != v2.complex_value (); -} +DEFBINOP_OP (lt, complex, complex, <) +DEFBINOP_OP (le, complex, complex, <=) +DEFBINOP_OP (eq, complex, complex, ==) +DEFBINOP_OP (ge, complex, complex, >=) +DEFBINOP_OP (gt, complex, complex, >) +DEFBINOP_OP (ne, complex, complex, !=) DEFBINOP_OP (el_mul, complex, complex, *)
--- a/src/OPERATORS/op-fcs-fcs.cc +++ b/src/OPERATORS/op-fcs-fcs.cc @@ -94,47 +94,12 @@ return octave_value (v2.float_complex_value () / d); } -DEFBINOP (lt, float_complex, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - - return real (v1.float_complex_value ()) < real (v2.float_complex_value ()); -} - -DEFBINOP (le, float_complex, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - - return real (v1.float_complex_value ()) <= real (v2.float_complex_value ()); -} - -DEFBINOP (eq, float_complex, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - - return v1.float_complex_value () == v2.float_complex_value (); -} - -DEFBINOP (ge, float_complex, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - - return real (v1.float_complex_value ()) >= real (v2.float_complex_value ()); -} - -DEFBINOP (gt, float_complex, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - - return real (v1.float_complex_value ()) > real (v2.float_complex_value ()); -} - -DEFBINOP (ne, float_complex, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - - return v1.float_complex_value () != v2.float_complex_value (); -} +DEFBINOP_OP (lt, float_complex, float_complex, <) +DEFBINOP_OP (le, float_complex, float_complex, <=) +DEFBINOP_OP (eq, float_complex, float_complex, ==) +DEFBINOP_OP (ge, float_complex, float_complex, >=) +DEFBINOP_OP (gt, float_complex, float_complex, >) +DEFBINOP_OP (ne, float_complex, float_complex, !=) DEFBINOP_OP (el_mul, float_complex, float_complex, *)