On Sep 7, 4:46*am, Jonathan Bromley <(E-Mail Removed)>

wrote:

> On Sat, 6 Sep 2008 15:59:01 -0700 (PDT), rickman <(E-Mail Removed)>

> wrote:

>

> > what you have written above is no different

> > than just treating the entire number as a 2's

> > complement value...

>

> Precisely. *The OP was asking about using a signed

> representation for the *fraction* as well as the integer

> part of a fixed-point number, and I was trying to show

> why that doesn't make a lot of sense.

>

> > Or are you just messing with our heads?

>

> Not intentionally. *I'm a little hard-pressed

> to understand why my attempt to enumerate

> a few values in conventional 2.8 fixed-point

> signed representation is upsetting you so
The problem is that you seem to be saying that there is nothing

different about fixed point integer vs. fraction and yet, you describe

the integer as signed and the fraction as not. I can describe

integers in the exact same terms you are describing fixed point by

talking about the integer part above 8 and the integer part below 8.

It is just simple math...

10 11 = -8 + (2 + 1) = 5

|| ||_ 1

|| |__ 2

||

||____ no 4

|_____ 8

The way you are looking at it, the separation really is not at the

fixed point, it is at the ***sign bit*** -2**(n-1) + ...

The definition of 2's comp of k is 2**n - k. You talk about

interpreting the bits with odd weights, i.e. -2**(n-1) * bit (n-1)

instead. Yes, this works, but this is not the definition of 2's

complement.

1011 = -16 + 8 + 2 + 1 = 5

||||_ 1

|||__ 2

||___ no 4

|____ 8

By using this altered notation, you make the integer and fraction

*appear* different.

10.11 = -2 + 0.5 + 0.25 = -1.25 = -5/4

|| ||_ .25

|| |__ .5

||____ no 1

|_____ 2

or

10.11 = -4 + 2 + (0.5 + 0.25) = -1.25

|| ||_ .25

|| |__ .5

||____ no 1

|_____ 2

Notice that I treat *all* the bits as positive values to be added to

the -2**n value. So the full number is a ***single*** 2's complement

entity. It makes no *sense* to talk about the integer and fraction as

separate notations.

Obviously we are saying the same conclusion, that there is no need to

introduce any special handling of the fraction vs. the integer. But

in the explanation of this conclusion, you *do* exactly that, treat

the integer and fraction differently!

Rick

> Perhaps this Number Representations 101

> express my intent more clearly, at least

> if you view it with a monospaced font:

>

> Ordinary binary integers work like this

> (using a 4-bit example)

>

> * *1011 * * * = 8 + 2 + 1 = 11

> * *||||_ 1

> * *|||__ 2

> * *||___ no 4

> * *|____ 8

>

> Twos complement works by making the most significant

> bit have the same value it would usually have, but

> negated:

>

> * *1011 * * * = -8 + 2 + 1 = -5

> * *||||_ 1

> * *|||__ 2

> * *||___ no 4

> * *|____ -8

>

> * *0011 * * * = 2 + 1 = 3

> * *||||_ 1

> * *|||__ 2

> * *||___ no 4

> * *|____ no -8

>

> In particular, note that every bit EXCEPT the MSB

> works in exactly the same way as it did for straight

> binary; the only difference is that the MSB is negative.

>

> Now let's move to fixed-point, using 2 integer and

> 2 fraction bits for the example. *Basically it's

> just an integer scaled by 1/4:

>

> * *1011 * * * = 2 + 0.5 + 0.25 = 2.75 = 11/4

> * *||||_ 0.25

> * *|||__ 0.50

> * *||___ no 1

> * *|____ 2

>

> And in twos complement, it's exactly the same

> except that the MSB is negative:

>

> * *1011 * * * = -2 + 0.5 + 0.25 = -1.25 = -5/4

> * *||||_ 0.25

> * *|||__ 0.50

> * *||___ no 1

> * *|____ -2

>

> * *0011 * * * = 0.5 + 0.25 = 0.75 = 3/4

> * *||||_ 0.25

> * *|||__ 0.50

> * *||___ no 1

> * *|____ no -2

>

> The fraction bits remain positive; there is no

> need to introduce a special signed representation

> for the fraction. *As rickman said, it's precisely

> a twos-complement integer - except you think of it

> as being right-shifted by the number of fraction bits.