Question

In: Computer Science

4. Describe and explain two characteristics of 2’s Compliment Representation of integer numbers that makes it...

4. Describe and explain two characteristics of 2’s Compliment Representation of integer numbers that makes it almost universally used in today’s digital computers.

Solutions

Expert Solution

The computer understands only binary as we know, and there is nothing called as negative number in the binary number system but it is absolutely necessary to represent a negative number using binary which can be done by assigning a sign bit to the number which is an extra bit required. If the sign bit is 1 then number is considered negative and if it is 0, than it will be the number will be called as positive. The main goal is to develop a technique which replaces a subtraction operation with an addition. In this way, we will be able to use the same circuit to perform both addition and subtraction. This will reduce the number of gates and, consequently, the size, power, and cost of the system.

Primary Advantage of two's complement is that the it has one value for zero while one's complement has 2 values for zero each for "Positive" zero & "Negative" zero.

Another advantage is that 2's complement doesn't require carry values.

we prefered 2's value because in this complement we do not require any carry value or extra 1.

so that the calculation part is very easy than 1's complement. so 2's complement is very preferable than 's complement.

Two's complement addition is very simple. You add numbers normally and any carry bit at the end is discarded. So they're added as follows:

0110

+1111

=10101

= 0101 (discard the carry)

But in your normal with negative number method, adding is more complicated:

0110

+ 1001

= 1111

Which is -7

For there are two zeroes for normal representation

0000 “zero"

1000 “negative zero"

Representation for different methods shown below

When you need to fill (padded bits) the register the value is being stored in. With two's complement, storing a 4-bit number in an 8-bit register is differs in larger required numbers to fill the register resulting repeating its most significant bit:

    0001 (one, in four bits)

00000001 (one, in eight bits)

    1110 (negative two, in four bits)

11111110 (negative two, in eight bits)

It's just a matter of looking at the sign bit of the smaller word and repeating it until it pads the width of the bigger word.

With your method you would need to clear the existing bit, which is an extra operation in addition to padding:

    0001 (one, in four bits)

00000001 (one, in eight bits)

    1010 (negative two, in four bits)

10000010 (negative two, in eight bits)

You still need to set those extra 4 bits in both cases, but in the normal case you need to clear the 5th bit as well. It's one tiny extra step in one of the most fundamental and common operations present in every application. Here we have to consider the MSB.It can cause a problem when numbers are not repeating.

Other characteristics of 2’s complement


Related Solutions

Prompt user to enter 2 integer numbers from console, compare and display these 2 numbers from...
Prompt user to enter 2 integer numbers from console, compare and display these 2 numbers from small to great. This is required to be done in MIPS assembly language.
Java Write a program that reads 4 integer numbers from the user combine it into a...
Java Write a program that reads 4 integer numbers from the user combine it into a single number. You need to ask the user to first specify how to combine the numbers (forward or backward). Note that for the backward option you need to check that the last digits should be 0, also for the forward option you need to check that the fist digit is not 0. Use for loops and switch for the menu.                       4. Write an application...
Design a program that will ask the user to input two integer numbers and then perform...
Design a program that will ask the user to input two integer numbers and then perform the basic arithmetic operations such as addition and subtraction. Each calculation is done by a separate function. The main function gets the input from the user, then calls the addition function and the subtraction function one at a time to perform the calculations. Each calculation function (addition or subtraction function) performs an arithmetic operation and then returns the calculation results back to where it...
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers,...
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers, • perform the operation shown, • show all work in binary operating on 4-bit numbers, and • identify overflow if necessary. a) 4 + 2 b) 4 – 2 c) 2 – 4 d) 4 + 4
Determine the IEEE single and double floating point representation of the following numbers: a) (15/2) x...
Determine the IEEE single and double floating point representation of the following numbers: a) (15/2) x 2^50 b) - (15/2) x 2^-50 c) 1/5
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7...
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7 5 -3
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7...
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7 5 -3
Write an Assembly code to input two integer numbers from keyboard, computes the division of two...
Write an Assembly code to input two integer numbers from keyboard, computes the division of two numbers WITHOUT using division operator and print out the reminder and quotient to the screen. Note: program using “division operator” will earn no credit for this task. You are ALLOWED to use the “print” and “read” macro
Two integer numbers a=10 and b=20 are stored in the data segment of the memory. The...
Two integer numbers a=10 and b=20 are stored in the data segment of the memory. The number a is stored in Mem[0x10010000] and b is stored in Mem[0x10010004]. Write MIPS assembly code to swap the two numbers, load a to a register, b to another register and store a at Mem[0x10010004], store b at Mem[0x10010000].
Please prove 1. Every positive integer is a product of prime numbers. 2. If a and...
Please prove 1. Every positive integer is a product of prime numbers. 2. If a and b are relatively prime, and a|bc, then a|c. 3. The division algorithm for F[x]. Just the existence part only, not the uniqueness part
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT