36 |
If x or y is complex, 0 or 1 is returned. |
If x or y is complex, 0 or 1 is returned. |
37 |
*/ |
*/ |
38 |
int |
int |
39 |
number_compare(x, y) |
number_compare(object x, object y) |
|
object x, y; |
|
40 |
{ |
{ |
41 |
int i; |
int i; |
42 |
double dx, dy; |
double dx, dy=0.0; |
43 |
vs_mark; |
vs_mark; |
44 |
|
|
45 |
switch (type_of(x)) { |
switch (type_of(x)) { |
164 |
goto LONGFLOAT; |
goto LONGFLOAT; |
165 |
case t_complex: |
case t_complex: |
166 |
goto Y_COMPLEX; |
goto Y_COMPLEX; |
167 |
|
default: |
168 |
|
break; |
169 |
} |
} |
170 |
LONGFLOAT: |
LONGFLOAT: |
171 |
if (dx == dy) |
if (dx == dy) |
185 |
return(1); |
return(1); |
186 |
|
|
187 |
case t_complex: |
case t_complex: |
188 |
if (type_of(y) != t_complex) |
if (type_of(y) != t_complex) { |
189 |
if (number_zerop(x->cmp.cmp_imag)) |
if (number_zerop(x->cmp.cmp_imag)) |
190 |
if (number_compare(x->cmp.cmp_real, y) == 0) |
if (number_compare(x->cmp.cmp_real, y) == 0) |
191 |
return(0); |
return(0); |
192 |
else |
else |
193 |
return(1); |
return(1); |
194 |
else |
else |
195 |
return(1); |
return(1); |
196 |
if (number_compare(x->cmp.cmp_real, y->cmp.cmp_real) == 0 && |
} |
197 |
number_compare(x->cmp.cmp_imag, y->cmp.cmp_imag) == 0 ) |
if (number_compare(x->cmp.cmp_real, y->cmp.cmp_real) == 0 && |
198 |
return(0); |
number_compare(x->cmp.cmp_imag, y->cmp.cmp_imag) == 0 ) |
199 |
else |
return(0); |
200 |
return(1); |
else |
201 |
|
return(1); |
202 |
|
|
203 |
default: |
default: |
204 |
FEwrong_type_argument(sLnumber, x); |
FEwrong_type_argument(sLnumber, x); |
205 |
|
return(0); |
206 |
} |
} |
207 |
} |
} |
208 |
|
|
209 |
Lall_the_same() |
void |
210 |
|
Lall_the_same(void) |
211 |
{ |
{ |
212 |
int narg, i; |
int narg, i; |
213 |
|
|
226 |
vs_base[0] = Ct; |
vs_base[0] = Ct; |
227 |
} |
} |
228 |
|
|
229 |
Lall_different() |
void |
230 |
|
Lall_different(void) |
231 |
{ |
{ |
232 |
int narg, i, j; |
int narg, i, j; |
233 |
|
|
251 |
vs_base[0] = Ct; |
vs_base[0] = Ct; |
252 |
} |
} |
253 |
|
|
254 |
Lnumber_compare(s, t) |
void |
255 |
int s, t; |
Lnumber_compare(int s, int t) |
256 |
{ |
{ |
257 |
int narg, i; |
int narg, i; |
258 |
|
|
271 |
vs_base[0] = Ct; |
vs_base[0] = Ct; |
272 |
} |
} |
273 |
|
|
274 |
Lmonotonically_increasing() { Lnumber_compare( 1, 1); } |
void Lmonotonically_increasing(void) { Lnumber_compare( 1, 1); } |
275 |
Lmonotonically_decreasing() { Lnumber_compare(-1, 1); } |
void Lmonotonically_decreasing(void) { Lnumber_compare(-1, 1); } |
276 |
Lmonotonically_nondecreasing() { Lnumber_compare( 1, 0); } |
void Lmonotonically_nondecreasing(void) { Lnumber_compare( 1, 0); } |
277 |
Lmonotonically_nonincreasing() { Lnumber_compare(-1, 0); } |
void Lmonotonically_nonincreasing(void) { Lnumber_compare(-1, 0); } |
278 |
|
|
279 |
Lmax() |
void |
280 |
|
Lmax(void) |
281 |
{ |
{ |
282 |
object max; |
object max; |
283 |
int narg, i; |
int narg, i; |
294 |
vs_base[0] = max; |
vs_base[0] = max; |
295 |
} |
} |
296 |
|
|
297 |
Lmin() |
void |
298 |
|
Lmin(void) |
299 |
{ |
{ |
300 |
object min; |
object min; |
301 |
int narg, i; |
int narg, i; |
312 |
vs_base[0] = min; |
vs_base[0] = min; |
313 |
} |
} |
314 |
|
|
315 |
init_num_comp() |
void |
316 |
|
init_num_comp(void) |
317 |
{ |
{ |
318 |
make_function("=", Lall_the_same); |
make_function("=", Lall_the_same); |
319 |
make_function("/=", Lall_different); |
make_function("/=", Lall_different); |