/[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.5 by camm, Thu Nov 6 16:08:09 2003 UTC revision 1.6 by camm, Thu Sep 16 21:25:22 2004 UTC
# Line 40  number_compare(object x, object y) Line 40  number_compare(object x, object y)
40  {  {
41          int i;          int i;
42          double dx, dy=0.0;          double dx, dy=0.0;
43            object q;
44          vs_mark;          vs_mark;
45    
46          switch (type_of(x)) {          switch (type_of(x)) {
# Line 98  number_compare(object x, object y) Line 99  number_compare(object x, object y)
99                          vs_reset;                          vs_reset;
100                          return(i);                          return(i);
101                  case t_shortfloat:                  case t_shortfloat:
102                          dx = number_to_double(x);                    if ((float)number_to_double((q=double_to_integer((double)sf(y))))==sf(y)) {
103                          dy = (double)(sf(y));                      i=number_compare(x,q);
104                          goto LONGFLOAT;                      vs_reset;
105                        return i;
106                      }
107                      dx=number_to_double(x);
108                      dy=(double)sf(y);
109                      goto LONGFLOAT;
110                  case t_longfloat:                  case t_longfloat:
111                          dx = number_to_double(x);                    if (number_to_double((q=double_to_integer(lf(y))))==lf(y)) {
112                          dy = lf(y);                      i=number_compare(x,q);
113                          goto LONGFLOAT;                      vs_reset;
114                        return i;
115                      }
116                      dx=number_to_double(x);
117                      dy=lf(y);
118                      goto LONGFLOAT;
119                  case t_complex:                  case t_complex:
120                          goto Y_COMPLEX;                          goto Y_COMPLEX;
121                  default:                  default:
# Line 128  number_compare(object x, object y) Line 139  number_compare(object x, object y)
139                          vs_reset;                          vs_reset;
140                          return(i);                          return(i);
141                  case t_shortfloat:                  case t_shortfloat:
142                          dx = number_to_double(x);                    if ((float)number_to_double((q=double_to_integer((double)sf(y))))==sf(y))
143                          dy = (double)(sf(y));                      y=q;
144                          goto LONGFLOAT;                    i=number_compare(x->rat.rat_num,number_times(x->rat.rat_den,y));
145                      vs_reset;
146                      return i;
147                  case t_longfloat:                  case t_longfloat:
148                          dx = number_to_double(x);                    if (number_to_double((q=double_to_integer(lf(y))))==lf(y))
149                          dy = lf(y);                      y=q;
150                          goto LONGFLOAT;                    i=number_compare(x->rat.rat_num,number_times(x->rat.rat_den,y));
151                      vs_reset;
152                      return i;
153                  case t_complex:                  case t_complex:
154                          goto Y_COMPLEX;                          goto Y_COMPLEX;
155                  default:                  default:
# Line 147  number_compare(object x, object y) Line 162  number_compare(object x, object y)
162    
163          case t_longfloat:          case t_longfloat:
164                  dx = lf(x);                  dx = lf(x);
165          LONGFLOAT0:          LONGFLOAT0:
166                  switch (type_of(y)) {                  switch (type_of(y)) {
167                  case t_fixnum:                  case t_fixnum:
168                          dy = (double)(fix(y));                          dy = (double)(fix(y));
169                          goto LONGFLOAT;                          goto LONGFLOAT;
170                  case t_bignum:                  case t_bignum:
171                      if (number_to_double((q=double_to_integer(dx)))==dx) {
172                        i=number_compare(q,y);
173                        vs_reset;
174                        return i;
175                      }
176                      dy=number_to_double(y);
177                      goto LONGFLOAT;
178                  case t_ratio:                  case t_ratio:
179                          dy = number_to_double(y);                    if (number_to_double((q=double_to_integer(dx)))==dx)
180                          goto LONGFLOAT;                      x=q;
181                      i=number_compare(number_times(x,y->rat.rat_den),y->rat.rat_num);
182                      vs_reset;
183                      return i;
184                  case t_shortfloat:                  case t_shortfloat:
185                          dy = (double)(sf(y));                          dy = (double)(sf(y));
186                          goto LONGFLOAT;                          goto LONGFLOAT;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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