/[gcl]/gcl/o/num_comp.c
ViewVC logotype

Diff of /gcl/o/num_comp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by wfs, Mon Dec 6 22:44:12 1999 UTC revision 1.2 by camm, Sat Jul 20 07:10:55 2002 UTC
# Line 36  Foundation, 675 Mass Ave, Cambridge, MA Line 36  Foundation, 675 Mass Ave, Cambridge, MA
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)) {
# Line 165  object x, y; Line 164  object x, y;
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)
# Line 184  object x, y; Line 185  object x, y;
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    
# Line 222  Lall_the_same() Line 226  Lall_the_same()
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    
# Line 246  Lall_different() Line 251  Lall_different()
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    
# Line 266  int s, t; Line 271  int s, t;
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;
# Line 288  Lmax() Line 294  Lmax()
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;
# Line 305  Lmin() Line 312  Lmin()
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);

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26