Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fractional Signed 2's complement representation

30 views
Skip to first unread message

knight

unread,
Sep 16, 2008, 7:37:45 AM9/16/08
to
Hi


What is the decimal representation of 1.111 1111 (signed 2's
complement number) ..?
I got it to be -0.0078125 but one site is telling that it is
-0.00390625

Which is correct..?

tarm...@gmx.de

unread,
Sep 16, 2008, 8:09:06 AM9/16/08
to
Hi,

it is -0.0078125:

1.111 1111 = -2 + 1 + 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625
+ 0.0078125

TP

knight

unread,
Sep 16, 2008, 11:51:04 PM9/16/08
to

Hi
thanks for the clarification
Ive found it in this site
http://www.swarthmore.edu/NatSci/echeeve1/Ref/BinaryMath/NumSys.html#signfrac
under heading Signed binary fractions

Thank you

Niv (KP)

unread,
Sep 17, 2008, 7:01:28 AM9/17/08
to
On 17 Sep, 04:51, knight <krshe...@gmail.com> wrote:
> On Sep 16, 5:09 pm, tarmop...@gmx.de wrote:
>
> > Hi,
>
> > it is -0.0078125:
>
> > 1.111 1111 = -2 + 1 + 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625
> > + 0.0078125
>
> > TP
>
> Hi
> thanks for the clarification
> Ive found it in this sitehttp://www.swarthmore.edu/NatSci/echeeve1/Ref/BinaryMath/NumSys.html#...

> under heading Signed binary fractions
>
> Thank you

No, not quite right:


-2 + 1 + 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625 + 0.0078125

is 9 terms.

Should it not be -1 for the 1 before the decimal point and then :
0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625 + 0.0078125 added to
the -1

Just my opinion of course.

Jonathan Bromley

unread,
Sep 17, 2008, 7:35:43 AM9/17/08
to
On Wed, 17 Sep 2008 04:01:28 -0700 (PDT), "Niv (KP)" wrote:

[discussing the meaning of 2s complement 1.111_1111]

>No, not quite right:
>-2 + 1 + 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625 + 0.0078125
>is 9 terms.
>
>Should it not be -1 for the 1 before the decimal point and then :
> 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625 + 0.0078125 added to
>the -1

Hah! In a recent discussion here, I offered the idea that the MSB
of any 2s complement value (fixed-point or integer, no matter)
should be treated as negative just as Kevin has (correctly) done.
Rickman gave me a hard time about that, saying that the
"definition" of 2s complement was (value)-2^N.

Personally I think the "definition" is silly, since it requires
you to use a different "definition" for negative and positive
values. Of course, both ways of thinking about it give the
same answer; Kevin uses the approach I favour, and therefore
thinks that the left-most 1 bit should actually mean -1;
Rickman would say that the initial 1 bit is positive like all
the others and therefore represents +1 but, because that MSB
is set,the number is 2s complement negative and therefore it's
necessary to subtract the phantom 2^N more-than-most-significant
bit from it. It seems to me that -2+1 is rather the same
as -1, so we're all correct (this time).

All I can say is that when I show people the representation
of 2s complement in which the MSB is thought of as having
a negative value, the overwhelming majority say something
like "boy, that makes it a lot easier to understand how
2s complement works". Whatever, pick something that works
for you and gives you the right answer!
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan...@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.

knight

unread,
Sep 17, 2008, 7:40:44 AM9/17/08
to
On Sep 17, 4:01 pm, "Niv (KP)" <kev.pars...@mbda-systems.com> wrote:

> No, not quite right:
> -2 + 1 + 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625 + 0.0078125
> is 9 terms.
>
> Should it not be -1 for the 1 before the decimal point and then :
> 0.5 + 0.25 + 0.125 + 0.0625 + 0.03125 + 0.015625 + 0.0078125 added to
> the -1
>
> Just my opinion of course.


aren't the both same.....?

Muzaffer Kal

unread,
Sep 20, 2008, 2:57:41 PM9/20/08
to
On Tue, 16 Sep 2008 04:37:45 -0700 (PDT), knight <krsh...@gmail.com>
wrote:

Another way to look at fractional two's complement signed numbers is
to use scaling. To go to fractional from integer in 1.7 format (as in
your example above) you need to scale the integers by 1/128 because
every left step you take with the binary point divides the number by
2 so x.7 means 1/128.
So 1111 1111 == -1 then 1.111 1111 == (-1) * 1/128 == -0.0078125.

0 new messages