home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / MATH / FREXP.S < prev    next >
Encoding:
Text File  |  1993-01-02  |  568 b   |  33 lines

  1. / frexp.s (emx+gcc) -- Copyright (c) 1992-1993 by Steffen Haecker
  2.  
  3. #include <libm.h>
  4.  
  5.         .globl  _frexp
  6.  
  7.         .text
  8.  
  9.         .align  2, 0x90
  10.  
  11. / double frexp (double x, int *exp_ptr)
  12.  
  13. #define x       4(%esp)
  14. #define exp_ptr 12(%esp)
  15.  
  16. _frexp:
  17.     movl    exp_ptr, %edx
  18.     movl    $0, (%edx)
  19.     fldl    __const_M_ONE           / -1
  20.         fldl    x                       / x
  21.     ftst
  22.     fstsww    %ax
  23.     andw    $0x4100, %ax
  24.     xorb    $0x40, %ah
  25.     jz    1f            / x = 0 ?
  26.     fxtract
  27.         fxch    %st(1)
  28.     fistpl    (%edx)
  29.         fscale
  30.     incl    (%edx)
  31. 1:    fstp    %st(1)
  32.     ret
  33.