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

Bitwise math/Negatives/Sign and Magnitude

From NetSec
Jump to: navigation, search
back to Bitwise math


The first bit is considered the sign bit, which if set, translates the number to it's negative counterpart. While this is very straightforward, it requires a a new operation to be supported by the hardware (subtraction), and generates two representations for the 0 value (10000000 and 00000000). As a result, the sign bit is usually used on the largest endian number (called the two's compliment implementation), so that there can be a negative value one value higher or lower than the highest positive value, for example:

  • 1000 = -8, while 0111 = 7