2's Complement Conversion and Addition in Unified Computing, Exercises of Computer Engineering and Programming

Problems related to converting base 10 numbers into 8-bit 2's complement notation and performing additions using bit strings in 2's complement notation. It also includes a hint for writing an algorithm to convert a negative decimal number into binary in 2's complement form and implementing it in ada95.

Typology: Exercises

2011/2012

Uploaded on 07/20/2012

savitri_85
savitri_85 🇮🇳

4

(5)

70 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Problem C5. (Unified Computers and programming)
1. Convert the following base 10 numbers into 8-bit 2’s complement notation
0, -1, -12
2. Perform each of the following additions assuming that the bit strings represent
values in 2’s complement notation. Identify the cases in which the answer is
incorrect because of overflow.
1111 01111 01110
+ 1111 +10001 +01010
Hint: The bit strings are only 5 bits long so your answer should also be 5 bits
long.
3. Write an algorithm to convert a negative decimal number into a binary number in
2’s complement form. Assume that the number ranges from +127 to -128
Hint: You already know how to convert a positive decimal number into binary
notation. Think about determining sign and inverting bit positions.
4. Implement your algorithm in Ada95. Turn in an electronic copy of your code
listing and a hard copy of your code.
docsity.com

Partial preview of the text

Download 2's Complement Conversion and Addition in Unified Computing and more Exercises Computer Engineering and Programming in PDF only on Docsity!

Problem C5. (Unified Computers and programming)

  1. Convert the following base 10 numbers into 8-bit 2’s complement notation

0, -1, -

  1. Perform each of the following additions assuming that the bit strings represent values in 2’s complement notation. Identify the cases in which the answer is incorrect because of overflow. 1111 01111 01110
  • 1111 +10001 +

Hint : The bit strings are only 5 bits long so your answer should also be 5 bits long.

  1. Write an algorithm to convert a negative decimal number into a binary number in 2’s complement form. Assume that the number ranges from +127 to -

Hint: You already know how to convert a positive decimal number into binary notation. Think about determining sign and inverting bit positions.

  1. Implement your algorithm in Ada95. Turn in an electronic copy of your code listing and a hard copy of your code.

docsity.com