I need to crack this little problem... Please can anyone help? I have a stream of numbers which are signed 16-bit integers, ranging from + 32767 (7FFF) to -32767 (8001). The MSB is the sign bit. -1 is FFFF. etc I wish to add these numbers to a signed 16-bit "output word". When negative numbers arrive, they are just added and the necessary subtraction seems to take place, no problems. However, I wish to limit the output word to +32767 and -32767. My anti-rollover strategy is as follows: If input and output words are both positive, add them. If the MSB has rolled over to 1 then just make the output word = 7FFF. If input and output words are opposite signs, just add. The result should lie within bounds. If input and output words are both negative... well this is where I go snow-blind. I first thought that if the sign bit went from 1 to 0, then a rollover had occurred. But this didn't account for all cases. My brain can't handle the depth of thought required until I have a bit more knowledge on the subject. I wish to keep the maths as simple as possible in order to reduce CPU overhead. Many thanks in advance... Have a good weekend Matt. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist