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

Diff of /gcl/o/num_co.c

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

revision 1.10 by camm, Sat Feb 15 00:38:28 2003 UTC revision 1.10.4.1 by camm, Wed Jul 16 02:02:51 2003 UTC
# Line 98  static void Line 98  static void
98  integer_decode_double(double d, int *hp, int *lp, int *ep, int *sp)  integer_decode_double(double d, int *hp, int *lp, int *ep, int *sp)
99  {  {
100          int h, l;          int h, l;
101            union {double d;int i[2];} u;
102    
103          if (d == 0.0) {          if (d == 0.0) {
104                  *hp = *lp = 0;                  *hp = *lp = 0;
# Line 109  integer_decode_double(double d, int *hp, Line 110  integer_decode_double(double d, int *hp,
110    
111    
112  #else  #else
113          h = *((int *)(&d) + HIND);          u.d=d;
114          l = *((int *)(&d) + LIND);          h=u.i[HIND];
115            l=u.i[LIND];
116    /*      h = *((int *)(&d) + HIND); */
117    /*      l = *((int *)(&d) + LIND); */
118  #endif  #endif
119  #ifdef VAX  #ifdef VAX
120          *ep = ((h >> 7) & 0xff) - 128 - 56;          *ep = ((h >> 7) & 0xff) - 128 - 56;
# Line 187  integer_decode_float(double d, int *mp, Line 191  integer_decode_float(double d, int *mp,
191  {  {
192          float f;          float f;
193          int m;          int m;
194            union {float f;int i;} u;
195    
196          f = d;          f = d;
197          if (f == 0.0) {          if (f == 0.0) {
# Line 195  integer_decode_float(double d, int *mp, Line 200  integer_decode_float(double d, int *mp,
200                  *sp = 1;                  *sp = 1;
201                  return;                  return;
202          }          }
203          m = *(int *)(&f);          u.f=f;
204            m=u.i;
205    /*      m = *(int *)(&f); */
206  #ifdef VAX  #ifdef VAX
207          *ep = ((m >> 7) & 0xff) - 128 - 24;          *ep = ((m >> 7) & 0xff) - 128 - 24;
208          *mp = ((m >> 16) & 0xffff) | (((m & 0x7f) | 0x80) << 16);          *mp = ((m >> 16) & 0xffff) | (((m & 0x7f) | 0x80) << 16);
# Line 227  integer_decode_float(double d, int *mp, Line 234  integer_decode_float(double d, int *mp,
234  static int  static int
235  double_exponent(double d)  double_exponent(double d)
236  {  {
237            union {double d;int i[2];} u;
238    
239          if (d == 0.0)          if (d == 0.0)
240                  return(0);                  return(0);
241  #ifdef VAX  #ifdef VAX
# Line 239  double_exponent(double d) Line 248  double_exponent(double d)
248  #ifdef NS32K  #ifdef NS32K
249    
250  #else  #else
251          return ((((*((int *)(&d) + HIND)) & 0x7ff00000) >> 20) - 1022);          u.d=d;
252            return (((u.i[HIND] & 0x7ff00000) >> 20) - 1022);
253  #endif  #endif
254  #endif  #endif
255  #ifdef MV  #ifdef MV
# Line 254  static double Line 264  static double
264  set_exponent(double d, int e)  set_exponent(double d, int e)
265  {  {
266          double dummy;          double dummy;
267            union {double d;int i[2];} u;
268    
269          if (d == 0.0)          if (d == 0.0)
270                  return(0.0);                  return(0.0);
271                        
272          *((int *)(&d) + HIND)          u.d=d;
273            u.i[HIND]
274  #ifdef VAX  #ifdef VAX
275          = *(int *)(&d) & 0xffff807f | ((e + 128) << 7) & 0x7f80;          = *(int *)(&d) & 0xffff807f | ((e + 128) << 7) & 0x7f80;
276  #endif  #endif
# Line 269  set_exponent(double d, int e) Line 281  set_exponent(double d, int e)
281  #ifdef NS32K  #ifdef NS32K
282    
283  #else  #else
284          = (*((int *)(&d) + HIND) & 0x800fffff) | (((e + 1022) << 20) & 0x7ff00000);          = (u.i[HIND] & 0x800fffff) | (((e + 1022) << 20) & 0x7ff00000);
285  #endif  #endif
286  #endif  #endif
287  #ifdef MV  #ifdef MV
# Line 1215  init_num_co(void) Line 1227  init_num_co(void)
1227          double smallest_double, smallest_norm_double, biggest_double;          double smallest_double, smallest_norm_double, biggest_double;
1228          float float_epsilon, float_negative_epsilon;          float float_epsilon, float_negative_epsilon;
1229          double double_epsilon, double_negative_epsilon;          double double_epsilon, double_negative_epsilon;
1230            union {double d;int i[2];} u;
1231            union {float f;int i;} uf;
1232    
1233    
1234  #ifdef VAX  #ifdef VAX
# Line 1232  init_num_co(void) Line 1246  init_num_co(void)
1246    
1247    
1248  #else  #else
1249            uf.i=1;
1250          ((int *) &smallest_float)[0]= 1;          u.i[HIND]=0;
1251          ((int *) &smallest_double)[HIND] = 0;          u.i[LIND]=1;
1252          ((int *) &smallest_double)[LIND] = 1;          smallest_float=uf.f;
1253            smallest_double=u.d;
1254    
1255    /*      ((int *) &smallest_float)[0]= 1; */
1256    /*      ((int *) &smallest_double)[HIND] = 0; */
1257    /*      ((int *) &smallest_double)[LIND] = 1; */
1258    
1259  #endif  #endif
1260  #endif  #endif
# Line 1277  init_num_co(void) Line 1296  init_num_co(void)
1296    
1297  #else  #else
1298    
1299          ((int *) &biggest_float)[0]= 0x7f7fffff;          uf.i=0x7f7fffff;
1300          ((int *) &biggest_double)[HIND] = 0x7fefffff;          u.i[HIND]=0x7fefffff;
1301          ((int *) &biggest_double)[LIND] = 0xffffffff;          u.i[LIND]=0xffffffff;
1302            
1303            biggest_float=uf.f;
1304            biggest_double=u.d;
1305    
1306    /*      ((int *) &biggest_float)[0]= 0x7f7fffff; */
1307    /*      ((int *) &biggest_double)[HIND] = 0x7fefffff; */
1308    /*      ((int *) &biggest_double)[LIND] = 0xffffffff; */
1309    
1310  #ifdef BAD_FPCHIP  #ifdef BAD_FPCHIP
1311   /* &&&& I am adding junk values to get past debugging */   /* &&&& I am adding junk values to get past debugging */

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.10.4.1

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