home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l200 / 6.ddi / LIB / FREXP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-21  |  423 b   |  24 lines

  1. /* frexp - extract the fraction and exponent from a double precision number
  2.            in 8086/8088 format
  3.  
  4.     Copyright (c) 1984 by JMI Software Consultants, Inc.
  5. */
  6. #include "acom.h"
  7.  
  8. DOUBLE frexp(val, ip)
  9.     DOUBLE val;
  10.     INT *ip;
  11.     {
  12.     INT *tip;
  13.  
  14.     if (val == 0.0)
  15.         *ip = 0;
  16.     else
  17.         {
  18.         tip = (INT *)&val;
  19.         *ip = ((tip[3] >> 4) & 0x7ff) - 0x3fe;
  20.         tip[3] = (tip[3] & 0x800f) + 0x3fe0;
  21.         }
  22.     return (val);
  23.     }
  24.