Sign-and-magnitude Method
In the first approach, the problem of representing a number's sign can be to allocate one sign bit to represent the sign: set that bit (often the most significant bit) to 0 for a positive number, and set to 1 for a negative number. The remaining bits in the number indicate the magnitude (or absolute value). Hence in a byte with only 7 bits (apart from the sign bit), the magnitude can range from 0000000 (0) to 1111111 (127). Thus you can represent numbers from −12710 to +12710 once you add the sign bit (the eighth bit). A consequence of this representation is that there are two ways to represent zero, 00000000 (0) and 10000000 (−0). This way, −4310 encoded in an eight-bit byte is 10101011.
This approach is directly comparable to the common way of showing a sign (placing a "+" or "−" next to the number's magnitude). Some early binary computers (e.g., IBM 7090) used this representation, perhaps because of its natural relation to common usage. Sign-and-magnitude is the most common way of representing the significand in floating point values.
Read more about this topic: Signed Number Representations
Famous quotes containing the word method:
“... [a] girl one day flared out and told the principal the only mission opening before a girl in his school was to marry one of those candidates [for the ministry]. He said he didnt know but it was. And when at last that same girl announced her desire and intention to go to college it was received with about the same incredulity and dismay as if a brass button on one of those candidates coats had propounded a new method for squaring the circle or trisecting the arc.”
—Anna Julia Cooper (18591964)