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..?
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 site
http://www.swarthmore.edu/NatSci/echeeve1/Ref/BinaryMath/NumSys.html#signfrac
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.
[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.
> 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.....?
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.