sc lecture 7
Key Concepts
Conversion between different bases
Algorithm 1
Calculation of the decimal value of a number in a given base

Negative numbers
- Representing signed numbers, together with positive ones, requires additional issues to be addressed, namely the inclusion of sign bits.
- There are many ways to represent negative numbers and we are going to discuss the next four:
- sign-magnitude
- one’s-complement, two’s-complement
- excess representations
Sign-magnitude
- The most intuitive method which uses:
- the MSB for the sign bit
- the remaining bits for the magnitude of the number (its absolute value aka modulus)
- By conventions, a ‘1’ in the sign bit indicates a negative number, whereas a ‘0’ indicates a positive number (or zero)
- In an 8-bit representation, two symmetrical values just differ in the sign bit.
- It is mandatory to know how many bits are used to represent the numbers because, for example, is negative if four bits are used, but positive if instead the numbers are represented with six bits. In this case, extra 0s can be added to the left part of the number ().
- A disadvantage of this method rests on the existence of ambiguity. The existence of two possible representations of zero ("" and "").
- The sign-magnitude contains the same number of positive and negative numbers.
- A sign-magnitude integer represention with bits ranges from to . With eight bits, this range goes from to .
- Calculations are performed basically with the same method as humans use with pencil and paper.
- If the sign are the same, add the magnitudes and use that same sign for the result;
- If the signs differs, determine which operand has the larger magnitude. The sign of the result is the same as the sign of the operand with the larger magnitude, and the magnitude by subtracting the smaller one from the larger one.