Questions about this topic? Sign up to ask in the talk tab.

Talk:Bitwise math

From NetSec
Revision as of 01:06, 24 June 2012 by KaraG14ycq (Talk | contribs) (Created page with "The Two's complement part starts explaining the sign and magnitude method as if it was a kind of 2's complement ---- Two's complement is a way to represent negative numbers in...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Two's complement part starts explaining the sign and magnitude method as if it was a kind of 2's complement



Two's complement is a way to represent negative numbers in binary, the same thing as giving an integer a sign. Getting into the mechanics of two's compliment, though it ends up with a few ways to do it. Signing bits are used these days. A two's complement is basically a NOT operation performed on the nibble. Any binary number is converted between positive and negative by computing its two's complement. Basically, the leftmost bit is called the sign bit. There are two ways. (taking nibbles as an example) -1 could be 1001. This is not useful, as now there are two ways to represent 0, 1000 for -0 and 0000 for ordinary 0. Also the addition and subtraction has to be changed for this. This is all not nice. This is why people invented two's complement, two's complement is basically using 1111 for -1 and 1000 for -8.