Re: negative hex
- From: John Larkin <jjlarkin@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 30 Jun 2008 21:23:41 -0700
On Mon, 30 Jun 2008 20:28:49 -0700, JosephKK <quiettechblue@xxxxxxxxx>
wrote:
On Sun, 29 Jun 2008 09:38:05 -0700, John Larkin
<jjlarkin@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
On Sun, 29 Jun 2008 14:09:41 +0800, rebel <me@xxxxxxxxxxx> wrote:
On Sat, 28 Jun 2008 11:23:18 -0700, John Larkin
<jjlarkin@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Microprocessors don't make value judgements about bits in registers;
only people do that. 0xFEEE is just a pattern of bits; whether it's
positive or negative is up to you.
John, I've been sitting on the side wondering whether to put in 2c worth, and
this seems like it is the time and place.
Surely it can't be "negative" if it is a pattern of bits. The bits are 0 or 1.
Not a negative option in sight.
I'm asking about how one would *express* a number which results from
the negation of an integer which is itself expressed in hex. A true
integer is a point on the infinite number line. In decimal, "256"
names one of those points in decimal; if we agree on the syntax, 0x100
names that same point in rad16.
Decimal -256 names a different point, one on the opposite side of the
origin from 256. So how should we agree to name that point in hex? I
think we agree that -0x100 is good.
Once we start to cram pure-mathematical integers into finite-length
binary registers, it gets a bit more complicated. It's still simple as
long as we agree on a naming convention for signed values (and 2's
complement is almost always the choice) and we don't overflow the
number of available bits. In 2's complement, if the most significant
bit of the register is set, we call the number negative.
8-bit wide, 2's complement convention:
0 0 0 0 0 0 0 0 = decimal 0
0 0 0 0 0 0 0 1 = decimal 1
0 0 0 0 0 0 1 1 = decimal 3
0 1 1 1 1 1 1 1 = decimal 127
1 0 0 0 0 0 0 0 = decimal -128
1 1 1 1 1 1 1 1 = decimal -1
John
There is good reason for that as well; it is the only system that
leverages the existing ALU to the max for doing multiple byte /
halfword / word / double-word and wider in a consistent manner.
And you claimed to not understand hex regrouping of 2's compliment.
Now I am confused. What is it that I claimed to not understand?
John
.
- References:
- Re: negative hex
- From: JosephKK
- Re: negative hex
- Prev by Date: Re: Drill Now for oil
- Next by Date: Re: Drill Now for oil
- Previous by thread: Re: negative hex
- Next by thread: Re: negative hex
- Index(es):
Relevant Pages
|