|
-
Dec 6th, 2007, 02:08 AM
#2
Fanatic Member
Re: Classic VB - Why is TRUE equal to -1 and not 1?
Perhaps we need also to explain the one complement number system.
You see, numbers are represented with one complement's number system. Under that system, when you want to get the negative of a number you inverse all the bit and then you add 1 to the bit.
So, 1 is 00000001... Inverse it and you got 11111110, add 1 and you got 11111111
So -1 is encoded as 11111111
Why one complement?
Say you want to add 1 with -1, you just add them as usual and ignore the left most carry all and get 0.
Hence, the same circuit used to add 2 positive numbers can be used to add negative numbers too without any change. That's good for computer's design point of view.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|