Mercurial > hg > octave-lojdl
changeset 9621:3ee9029931b3
fix scalar complex-real comparisons
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 06 Sep 2009 07:41:34 +0200 |
parents | b00af0da85dd |
children | 40cbcdf12b54 |
files | src/ChangeLog src/OPERATORS/op-cs-s.cc src/OPERATORS/op-fcs-fs.cc src/OPERATORS/op-fs-fcs.cc src/OPERATORS/op-s-cs.cc |
diffstat | 5 files changed, 31 insertions(+), 164 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2009-09-06 Jaroslav Hajek <highegg@gmail.com> + + * OPERATORS/op-s-cs.cc: Use DEFCMPLXCMPOP_OP. + * OPERATORS/op-cs-s.cc: Ditto. + * OPERATORS/op-fs-fcs.cc: Ditto. + * OPERATORS/op-fcs-fs.cc: Ditto. + 2009-09-05 John W. Eaton <jwe@octave.org> * genprops.awk: Fix formatting of generated output.
--- a/src/OPERATORS/op-cs-s.cc +++ b/src/OPERATORS/op-cs-s.cc @@ -68,47 +68,12 @@ return octave_value (v2.double_value () / d); } -DEFBINOP (lt, complex, scalar) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&); - - return real (v1.complex_value ()) < v2.double_value (); -} - -DEFBINOP (le, complex, scalar) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&); - - return real (v1.complex_value ()) <= v2.double_value (); -} - -DEFBINOP (eq, complex, scalar) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&); - - return v1.complex_value () == v2.double_value (); -} - -DEFBINOP (ge, complex, scalar) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&); - - return real (v1.complex_value ()) >= v2.double_value (); -} - -DEFBINOP (gt, complex, scalar) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&); - - return real (v1.complex_value ()) > v2.double_value (); -} - -DEFBINOP (ne, complex, scalar) -{ - CAST_BINOP_ARGS (const octave_complex&, const octave_scalar&); - - return v1.complex_value () != v2.double_value (); -} +DEFCMPLXCMPOP_OP (lt, complex, scalar, <) +DEFCMPLXCMPOP_OP (le, complex, scalar, <=) +DEFCMPLXCMPOP_OP (eq, complex, scalar, ==) +DEFCMPLXCMPOP_OP (ge, complex, scalar, >=) +DEFCMPLXCMPOP_OP (gt, complex, scalar, >) +DEFCMPLXCMPOP_OP (ne, complex, scalar, !=) DEFBINOP_OP (el_mul, complex, scalar, *)
--- a/src/OPERATORS/op-fcs-fs.cc +++ b/src/OPERATORS/op-fcs-fs.cc @@ -71,47 +71,12 @@ return octave_value (v2.float_value () / d); } -DEFBINOP (lt, float_complex, float) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - - return real (v1.float_complex_value ()) < v2.float_value (); -} - -DEFBINOP (le, float_complex, float) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - - return real (v1.float_complex_value ()) <= v2.float_value (); -} - -DEFBINOP (eq, float_complex, float) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - - return v1.float_complex_value () == v2.float_value (); -} - -DEFBINOP (ge, float_complex, float) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - - return real (v1.float_complex_value ()) >= v2.float_value (); -} - -DEFBINOP (gt, float_complex, float) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - - return real (v1.float_complex_value ()) > v2.float_value (); -} - -DEFBINOP (ne, float_complex, float) -{ - CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - - return v1.float_complex_value () != v2.float_value (); -} +DEFCMPLXCMPOP_OP (lt, float_complex, float_scalar, <) +DEFCMPLXCMPOP_OP (le, float_complex, float_scalar, <=) +DEFCMPLXCMPOP_OP (eq, float_complex, float_scalar, ==) +DEFCMPLXCMPOP_OP (ge, float_complex, float_scalar, >=) +DEFCMPLXCMPOP_OP (gt, float_complex, float_scalar, >) +DEFCMPLXCMPOP_OP (ne, float_complex, float_scalar, !=) DEFBINOP_OP (el_mul, float_complex, float_scalar, *)
--- a/src/OPERATORS/op-fs-fcs.cc +++ b/src/OPERATORS/op-fs-fcs.cc @@ -71,47 +71,12 @@ return octave_value (v2.float_complex_value () / d); } -DEFBINOP (lt, float_scalar, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&); - - return v1.float_value () < real (v2.float_complex_value ()); -} - -DEFBINOP (le, float_scalar, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&); - - return v1.float_value () <= real (v2.float_complex_value ()); -} - -DEFBINOP (eq, float_scalar, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&); - - return v1.float_value () == v2.float_complex_value (); -} - -DEFBINOP (ge, float_scalar, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&); - - return v1.float_value () >= real (v2.float_complex_value ()); -} - -DEFBINOP (gt, float_scalar, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&); - - return v1.float_value () > real (v2.float_complex_value ()); -} - -DEFBINOP (ne, float_scalar, float_complex) -{ - CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex&); - - return v1.float_value () != v2.float_complex_value (); -} +DEFCMPLXCMPOP_OP (lt, float_scalar, float_complex, <) +DEFCMPLXCMPOP_OP (le, float_scalar, float_complex, <=) +DEFCMPLXCMPOP_OP (eq, float_scalar, float_complex, ==) +DEFCMPLXCMPOP_OP (ge, float_scalar, float_complex, >=) +DEFCMPLXCMPOP_OP (gt, float_scalar, float_complex, >) +DEFCMPLXCMPOP_OP (ne, float_scalar, float_complex, !=) DEFBINOP_OP (el_mul, float_scalar, float_complex, *)
--- a/src/OPERATORS/op-s-cs.cc +++ b/src/OPERATORS/op-s-cs.cc @@ -70,47 +70,12 @@ return octave_value (v2.complex_value () / d); } -DEFBINOP (lt, scalar, complex) -{ - CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&); - - return v1.double_value () < real (v2.complex_value ()); -} - -DEFBINOP (le, scalar, complex) -{ - CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&); - - return v1.double_value () <= real (v2.complex_value ()); -} - -DEFBINOP (eq, scalar, complex) -{ - CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&); - - return v1.double_value () == v2.complex_value (); -} - -DEFBINOP (ge, scalar, complex) -{ - CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&); - - return v1.double_value () >= real (v2.complex_value ()); -} - -DEFBINOP (gt, scalar, complex) -{ - CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&); - - return v1.double_value () > real (v2.complex_value ()); -} - -DEFBINOP (ne, scalar, complex) -{ - CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&); - - return v1.double_value () != v2.complex_value (); -} +DEFCMPLXCMPOP_OP (lt, scalar, complex, <) +DEFCMPLXCMPOP_OP (le, scalar, complex, <=) +DEFCMPLXCMPOP_OP (eq, scalar, complex, ==) +DEFCMPLXCMPOP_OP (ge, scalar, complex, >=) +DEFCMPLXCMPOP_OP (gt, scalar, complex, >) +DEFCMPLXCMPOP_OP (ne, scalar, complex, !=) DEFBINOP_OP (el_mul, scalar, complex, *)