comparison src/OPERATORS/op-s-cs.cc @ 9621:3ee9029931b3

fix scalar complex-real comparisons
author Jaroslav Hajek <highegg@gmail.com>
date Sun, 06 Sep 2009 07:41:34 +0200
parents eb63fbe60fab
children ac4b97c6bf8b
comparison
equal deleted inserted replaced
9620:b00af0da85dd 9621:3ee9029931b3
68 gripe_divide_by_zero (); 68 gripe_divide_by_zero ();
69 69
70 return octave_value (v2.complex_value () / d); 70 return octave_value (v2.complex_value () / d);
71 } 71 }
72 72
73 DEFBINOP (lt, scalar, complex) 73 DEFCMPLXCMPOP_OP (lt, scalar, complex, <)
74 { 74 DEFCMPLXCMPOP_OP (le, scalar, complex, <=)
75 CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&); 75 DEFCMPLXCMPOP_OP (eq, scalar, complex, ==)
76 76 DEFCMPLXCMPOP_OP (ge, scalar, complex, >=)
77 return v1.double_value () < real (v2.complex_value ()); 77 DEFCMPLXCMPOP_OP (gt, scalar, complex, >)
78 } 78 DEFCMPLXCMPOP_OP (ne, scalar, complex, !=)
79
80 DEFBINOP (le, scalar, complex)
81 {
82 CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
83
84 return v1.double_value () <= real (v2.complex_value ());
85 }
86
87 DEFBINOP (eq, scalar, complex)
88 {
89 CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
90
91 return v1.double_value () == v2.complex_value ();
92 }
93
94 DEFBINOP (ge, scalar, complex)
95 {
96 CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
97
98 return v1.double_value () >= real (v2.complex_value ());
99 }
100
101 DEFBINOP (gt, scalar, complex)
102 {
103 CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
104
105 return v1.double_value () > real (v2.complex_value ());
106 }
107
108 DEFBINOP (ne, scalar, complex)
109 {
110 CAST_BINOP_ARGS (const octave_scalar&, const octave_complex&);
111
112 return v1.double_value () != v2.complex_value ();
113 }
114 79
115 DEFBINOP_OP (el_mul, scalar, complex, *) 80 DEFBINOP_OP (el_mul, scalar, complex, *)
116 81
117 DEFBINOP (el_div, scalar, complex) 82 DEFBINOP (el_div, scalar, complex)
118 { 83 {