Dale - Computer Science Illuminated 87

Dale - Computer Science Illuminated 87 - number in twos...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Overflow A situation where a calculated value cannot fit into the number of digits reserved for it 60 Chapter 3 Data Representation Two’s Complement Let’s assume that a number must be represented in eight bits. To make it easier to look at long binary numbers, we make the number line vertical: Addition and subtraction are accomplished the same way as in 10’s complement arithmetic: – 127 10000001 + 1 00000001 – 126 10000010 Notice that with this representation, the leftmost bit in a negative number is always a 1. Therefore, you can tell immediately whether a binary
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: number in twos complement is negative or positive. Number Overflow Overflow occurs when the value that we compute cannot fit into the number of bits we have allocated for the result. For example, if each value is stored using eight bits, adding 127 to 3 would overflow: 11111111 10000010 10000001 10000000 11111110 01111111 01111110 00000010 00000001 00000000 1 126 127 128 2 127 126 2 1 . . . . . . . . . . . ....
View Full Document

This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.

Ask a homework question - tutors are online