home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / m88k / 392 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.8 KB  |  46 lines

  1. Newsgroups: comp.sys.m88k
  2. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!world!jkenton
  3. From: jkenton@world.std.com (Jeff Kenton)
  4. Subject: Re: Single precision underflow rounding
  5. Message-ID: <C01Iqp.A9B@world.std.com>
  6. Organization: Kenton Systems Corporation, Weston MA
  7. References: <1992Dec29.204905.18841@eagle.lerc.nasa.gov>
  8. Distribution: na
  9. Date: Tue, 29 Dec 1992 21:37:37 GMT
  10. Lines: 34
  11.  
  12. fsset@bach.lerc.nasa.gov (Scott Townsend) writes:
  13.  
  14. >I've recently discovered a discrepancy between my underflow handling for
  15. >single-precision results and that of SGI and SUN machines.  I can't seem to
  16. >get the rounding to match, yet the SGI and SUN match each other, so I assume
  17. >I'm wrong ;-)
  18.  
  19. Well, it's getting to be quite a while since I did this, but I'll give
  20. it a shot.
  21.  
  22. First thing you need to do is to check the addone bit to see if rounding
  23. added one to the mantissa.  If it did you need to subtract one from the
  24. mantissa.  If the mantissa had only the hidden bit set, this will unset
  25. it and leave the rest of the mantissa bits set.  Set the hidden bit (the
  26. same as shifting left and or'ing the low bit) and decrement the exponent.
  27.  
  28. Concatenate the mantissa with the guard, round and sticky bits, figure out
  29. how far to shift the mantissa, and shift.  Recalculate the resulting GRS
  30. bits (sticky could be the only thing left -- get it right).  Now decide
  31. whether you need to round up.  I did it by concatenating the sign, rounding
  32. mode and GRS bits, and doing a table lookup.
  33.  
  34. Once you've added the rounding to the mantissa, go reconstruct your number.
  35.  
  36. Hope that helps.
  37.  
  38. [Hi, Scott]
  39.  
  40.  
  41. -- 
  42. -------------------------------------------------------------------------
  43. =            Jeff Kenton    (617) 894-4508            =
  44. =                jkenton@world.std.com            =
  45. -------------------------------------------------------------------------
  46.