Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/16/12 17:12
Read: times


 
#187953 - add before shift
Responding to: ???'s previous message
Add 0.5 to the number before shifting. Obviously not the floating point value 0.5, but the integer representing 0.5 in your fixed-point notation.

So if you are going to shift right 1 time, you add 1.
If you are going to shift right 2 times, you add 2.
If you are going to shift right 3 times, you add 4.

Obviously, you have to make sure that the addition before the shift doesn't result in an overflow.


List of 9 messages in thread
TopicAuthorDate
Right Shift Rounding Recommendations            01/01/70 00:00      
   add before shift            01/01/70 00:00      
   Guard digits?            01/01/70 00:00      
      How does this look?            01/01/70 00:00      
         Nice but..            01/01/70 00:00      
   Please elaborate further.            01/01/70 00:00      
                   01/01/70 00:00      
      I do not know how you managed, but            01/01/70 00:00      
         breaking the rules, one forum at a time . . .            01/01/70 00:00      

Back to Subject List