home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 250_01 / pow.s < prev    next >
Text File  |  1987-10-29  |  768b  |  37 lines

  1.     .ttl    "pow.s"
  2.  
  3. * MC68020/MC68881 IEEE Format Single Precision Routines
  4. *
  5. * Written by: Edmund H. Ramm
  6. *
  7. * _pow entry point for s.p. x^y, ops. in 4(sp) and 8(sp)
  8. *
  9. *     sp     4        8
  10. *    --------------------------
  11. *    | ret  |mantissa|exponent|
  12.  
  13.  
  14.     .text
  15.     .globl    _pow
  16.  
  17.  
  18. _pow:
  19. *
  20. *    on exit, d0 = pow( 4(sp), 8(sp) )
  21.  
  22.     moveq    #0,d0
  23.     btst    #7,4(sp)        * negative mantissa?
  24.     bne.s    L_pow1            * yes, exit with result = 0.0
  25. *    flogn.s    4(sp),fp0        * fp0 <-- log(mantissa)
  26.     dc.w    $f22f,$4414,$0004
  27. *    fmul.s    8(sp),fp0        * perform x^y
  28.     dc.w    $f22f,$4423,$0008
  29. *    fetox.x    fp0            * fp0 <-- exp(log(x) * y)
  30.     dc.w    $f200,$0010
  31. *    fmove.s    fp0,d0            * d0 <-- result
  32.     dc.w    $f200,$6400
  33. L_pow1:
  34.     rts
  35.  
  36.     .end
  37.