On Sun, Mar 13, 2016 at 3:16 PM, Lawrence Wilkinson <[email protected]> wrote:
> I haven't gone through your code in great detail. In particular I'm > not sure what your rounding algorithm is (towards zero, round to > nearest, etc.) I don't see what you're using the guard bit for, I > would expect it to be appended to the mantissa prior to addition > and rounding. Whether that's significant would depend on how you > expect the rounding to work. > > I was experimenting with the IEEE rounding algorithms, which are driven by guard bit, last bit, sticky bit; I left that data collection in place. Using sticky bit got the best results. You're not sure what the rounding algorithm is because I don't know what it should be. Two suggestions (which you may well have tried): > > 1. Try an extra guard bit. > > if mantissa negative and the last 3 bits shifted out are ones, then round (for this case, set the mantissa to 0)? > 2. Convert to sign+magnitude so you don't have to worry about negative > mantissas (i.e. negate a negative mantissa before shifting and back > again after alignment). > > [So far] the only test failures have been with negative mantissas, so I don't think that I gain anything by going to sign-and-magnitude; I'd be tracking zeros being shifted off instead of ones, which it isn't going to change the rounding algorithm, just the implementation. -- Charles
