T C wrote: > I thought I saw an app note/article/design idea/or somethin' > that discussed how to detect if a resulting value > outside -32768 -> 32767 > would occur with: > > i16_op1 - i16_op2 > or > i16_op1 - u16_op2 (u16 might be 0-32767 only) > > Trying to avoid using 24 bits. > > Anyone see the doc? ... any ideas? TC: Overflow only occurs when you add two numbers of the same sign, so if you're adding a positive number to a negative number, overflow cannot occur. When overflow occurs, the sign of the result is different from the sign of the two inputs: if both inputs are negative and the result is positive, or if both inputs are positive and the result is negative, an overflow has occurred. -Andy === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist