Exact match. Not showing close matches.
PICList
Thread
'[PIC] detecting overflow without using 24bits'
2004\09\22@144112
by
T C
2004\09\22@174153
by
Andrew Warren
|
T C <spam_OUTpiclistTakeThisOuT
mit.edu> 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 -- .....aiwKILLspam
@spam@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
More... (looser matching)
- Last day of these posts
- In 2004
, 2005 only
- Today
- New search...