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