piclist 2001\03\08\231332a >
Thread: Comparison of signed 16bit values from addition or subtraction
www.piclist.com/techref/microchip/devices.htm?key=pic
flavicon
face 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 <KILLspamjamesnewtonspam.....PICLIST.COM>
Sent: Friday, March 09, 2001 0:04:48
 To: KILLspamPICLISTRemoveMEspamMITVMA.MIT.EDU
Subj: [pic]: Comparison of signed 16bit values from addition or              subtraction

{Quote hidden}

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

In reply to: <000301c0a81b$cabde5c0$0600a8c0@efplus.com>
See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Comparison of signed 16bit values from addition or subtraction

month overview.

new search...