1 4. Computer Maths and Logic 4.1 Number Systems
4.1.1 Calculation
3 Addition In binary, = = = = 0 carry 1, or 10 2 Note that these are the same rules as in decimal.
4 Addition In decimal, = 2 carry 1, or 12 When doing addition, you always “carry” the overflow left i.e. add 1 into the column on the left.
5 Addition Remember hexadecimal uses A B C D E F before overflowing In hexadecimal, = C (no need to carry) 9 + A = 3 carry 1, or C + E = A carry 1, or 1A 16
6 Subtraction Subtraction involves “borrowing” from the left column. If nothing is available, the answer is negative. In decimal, = -6, with a borrow of 10 = = 4
7 Subtraction In binary, = = = = -1 borrow 10, or 1 Of course if the last example were 0 – 1, the answer would be -1.
8 Subtraction In hexadecimal, = 6 D - 5 = = -4 borrow 10 16, = C B = 5