Dale - Computer Science Illuminated 86

Dale - Computer Science Illuminated 86 - to compute the...

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

View Full Document Right Arrow Icon
Ten’s complement A representation of nega- tive numbers such that the negative of I is 10 raised to k minus . 3.2 Representing Numeric Data 59 let’s try adding a positive number and a negative number, a negative number and a positive number, and two negative numbers. These are shown below in sign-magnitude and in this scheme. (Note that the carries are discarded.) What about subtraction, using this scheme for representing negative numbers? The key is in the relationship between addition and subtraction: A ± B = A + ( ± B). We can subtract one number from another by adding the negative of the second to the first. In this example, we have assumed a fixed size of 100 values, and kept our numbers small enough to use the number line to calculate the negative representation of a number. However, there is a formula that you can use
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: to compute the negative representation. Negative( I ) = 10 k ± I , where k is the number of digits This representation of negative numbers is called the ten’s complement . Although humans tend to think in terms of sign and magnitude to repre-sent numbers, the complement strategy is actually easier in some ways when it comes to electronic calculations. And since we store everything in a modern computer in binary, we use the binary equivalent of the ten’s complement, called the two’s complement. Sign – Magnitude –5 – 3 –8 New Scheme 95 – 3 Add Negative 95 + 97 92 Sign-Magnitude New Scheme 5 + – 6 – 1 – 4 + 6 2 – 2 + – 4 – 6 5 + 94 99 96 + 6 2 98 + 96 94...
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