piclist 2001\03\08\231332a >
www.piclist.com/techref/microchip/devices.htm?key=pic
BY : Nikolai Golovchenko email (remove spam text)

Just an idea. How about modifying the signed format to a biased
format and compare biased values as unsigned numbers?

By a biased format I mean inverted sign bit. That would shift the
least signed value to 0, zero to middle, and highest signed value to
highest unsigned value. For example,

-128 ^ 128 = 0
-127 ^ 128 = 1
-127 ^ 128 = 2
...
-1   ^ 128 = 127
0    ^ 128 = 128
1    ^ 128 = 129
2    ^ 128 = 130
...
127  ^ 128 = 255

Then just use unsigned routines for comparison. To restore the input
values, invert sign bits again.

Hope it helps,

Nikolai

---- Original Message ----
From: James Newton <jamesnewtonPICLIST.COM>
Sent: Friday, March 09, 2001 0:04:48
To: PICLISTMITVMA.MIT.EDU
Subj: [pic]: Comparison of signed 16bit values from addition or              subtraction

{Quote hidden}

> {Original Message removed}
<381887225.20010309061243@yahoo.com> 7bit