negative binary

General technological topics without their own forum go here

negative binary

Post by anmolnanda on Sat Dec 25, 2010 2:14 am
([msg=51100]see negative binary[/msg])

10100010
(4+64+256)
00100010
(4+64)

when positive 64 and -64 can be represented as the above numerical value,in contrast to the 1st binary vale which numerically represents 324.so what is it 324 or 64
anmolnanda
New User
New User
 
Posts: 1
Joined: Sat Dec 25, 2010 2:08 am
Blog: View Blog (0)


Re: negative binary

Post by Goatboy on Sat Dec 25, 2010 3:12 am
([msg=51108]see Re: negative binary[/msg])

urdoinitrong

The far-most right digit represents 1, then to the left of that is 2, then 4, 8, 16, 32, 64, 128. You started with 2 and ended with 256, which is wrong.

Those two numbers are 162 and 34, top to bottom. In addition, a number is only represented as positive or negative when it is a signed value, in which case only the right-most 7 bits are used to count, and the left-most is used to signify the positive or negative value. In this case, the value "1" in the highest-value bit (farthest to left) means the number is negative, and that bit is not used for calculating the value. In this case, the numbers are -34 and 34, respectively.

Remember, a single byte can only go up to 255, so the value of 324 would make no sense anyways.

http://en.wikipedia.org/wiki/Signed_num ... sentations
Assume that everything I say is or could be a lie.
19JAW6GabFHqe9yD9rr26QL3W3V2pNitbD
User avatar
Goatboy
Expert
Expert
 
Posts: 2863
Joined: Mon Jul 07, 2008 9:35 pm
Blog: View Blog (0)


Re: negative binary

Post by fashizzlepop on Sat Dec 25, 2010 3:29 am
([msg=51110]see Re: negative binary[/msg])

I honestly learned something new today. Thanks Goatboy.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: negative binary

Post by Goatboy on Sat Dec 25, 2010 4:48 am
([msg=51113]see Re: negative binary[/msg])

fashizzlepop wrote:I honestly learned something new today. Thanks Goatboy.

urwelcum
Assume that everything I say is or could be a lie.
19JAW6GabFHqe9yD9rr26QL3W3V2pNitbD
User avatar
Goatboy
Expert
Expert
 
Posts: 2863
Joined: Mon Jul 07, 2008 9:35 pm
Blog: View Blog (0)



Return to General

Who is online

Users browsing this forum: No registered users and 0 guests