Signed Number Representations - Sign-and-magnitude Method

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:

    Relying on any one disciplinary approach—time-out, negotiation, tough love, the star system—puts the parenting team at risk. Why? Because children adapt to any method very quickly; today’s effective technique becomes tomorrow’s worn dance.
    Ron Taffel (20th century)