home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP24.EXE / CHP2414.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-30  |  774 b   |  50 lines

  1.  /* Program....: Ieereal.c
  2.  *
  3.  * syntax:   ieereal( nIEEVar )
  4.  * returns:  char string of length 8.  each char in string
  5.  *           represents the appropriate byte of nIEEVar.
  6.  *
  7.  * syntax:   realiee( cIEEStr )
  8.  * returns:  double.  converts cIEEStr to it's double
  9.    equivalent
  10.  *
  11.  * compile:  msc 5.1 -- cl /W3 /Ox /AL /Gs /c /FPa /Zl
  12.    ieereal.c
  13.  *
  14.  */
  15.  
  16. #include "extend.h"
  17.  
  18. CLIPPER ieereal(void);
  19. CLIPPER realiee(void);
  20.  
  21.  
  22. union {
  23.         double n;
  24.         char   s[8];
  25.       } v;
  26.  
  27.  
  28. CLIPPER ieereal()
  29. {
  30.     double n;
  31.  
  32.     n = _parnd(1);
  33.  
  34.     _retclen( (char far *) &n, 8);
  35. }
  36.  
  37.  
  38. CLIPPER realiee()
  39. {
  40.     char i;
  41.     char far *t;
  42.  
  43.     t = _parc(1);
  44.  
  45.     for (i = 0; i < 8; i++)
  46.         v.s[i] = *t++;
  47.  
  48.     _retnd( v.n );
  49. }
  50.