Question

In: Computer Science

1 - Briefly describe overflow. When does it occur? 2 - Briefly describe underflow. When does...

1 - Briefly describe overflow. When does it occur?

2 - Briefly describe underflow. When does it occur?

3 - What decimal number does the bit pattern 1101 1011 represent if it is a:

• unsigned integer?

• sign-magnitude integer?

• two's complement integer?

4 - What decimal number does the bit pattern 0011 1011 represent if it is a:

• unsigned integer?

• sign-magnitude integer?

• two's complement integer?

5 - What is the binary representation of the decimal number 28 assuming the IEE 754 single precision format?

6 - What decimal number does the bit pattern 0xBF800000 represent if it is:

• A two's complement integer?

• An unsigned integer?

• A floating point number assuming the IEE 754 single precision format

7 - Perform the following calculations assuming that the values are 4-bit decimal integers stored in two's complement format. Be sure to consider the possibility of overflow.

• 1101 + 0011

• 1101 – 0011

8 – For the following operations: write the operands as 2's complement binary numbers then perform the addition or subtraction operation shown. Show all work in binary operating on 4-bit numbers.

• 4 + 2

• 4 - 2

• 2 - 4

Solutions

Expert Solution

Answer 1:

An overflow is occurred when result would have more bits than the bits in original numbers.

The rules for detecting overflow in a two's complement sum are simple:

1. When we perform the sum of two positive/negative numbers the sum is exceed the range of the bit field of those two numbers.

2. If the operands have different (resp. identical) signs overflow cannot occur in addition (subtraction).

If we add two positive number 7 + 6 using 4-bit binary number, result should be +13

Carry

1

1

(+7)

0

1

1

1

(+6)                   +

0

1

1

0

(-3)

1

1

0

1

In signed notation, this is a result of -3, not +13, so overflow occurs

Answer 2:

An underflow is occurred when the result of a calculation is a number of smaller absolute value than the computer can actually store in memory

For example, an 8-bit computer is capable of storing unsigned integers ranging from 0–255. If result generated after performing any operation is less than 0 then an underflow is occur.

An underflow can occurs when the result of a after performing floating point operation is smaller than the smallest value representable.

If we add two positive number -120 and -9 using2’s complement number, result should be -129 which is the smallest possible value that we can represent by a 8-bit 2’s complement number (-128) so overflow occurs .

Carry

(-120)

1

0

0

0

1

0

0

0

(-9)       +            

1

1

1

1

0

1

1

1

(-129)

1

0

1

1

1

1

1

1

1

Carry generated so discard it and take 2’s complement of result which 10000001(-129)

Answer 3:

i) Unsigned integer

Binary to Decimal Conversion

• Technique

– Multiply each bit by 2n, where n is the “weight” of the bit

– The weight is the position of the bit, starting from 0 on the right

– Add the results

i)Determine the Decimal equivalent of ( 1101 1011)2

Binary

1

1

0

1

1

0

1

1

Number

Weight of

27

26

25

24

23

22

21

20

Each Bit

Weighted

1 X27

1 X26

0X25

1 X24

1 X23

0X22

1X21

1X 20

Value

Solved

128

64

0

16

8

0

2

1

Multiplication

Sum of weight of all bits = 128+64+16+8+2+1=219

Answer: (1101 1011)2 = (219)10

ii) Signed integer

In case of Signed Number If MSB bit is 0 then number is Positive number and if it is 1 then number is negative number.

For given number MSB is 1 so number is negative and remaining bit give magnitude we can convert it into decimal by applying above method. Which is 91.

MSB (signed bit)

Magnitude

1

1011011

Answer: (1101 1011)2 = -(91)10

iii) Two's complement integer

In this case take 2’s complement of given number and convert into decimal using above method.

For 2’s complement take 1’s complement and then add 1 into it.1’s complement means change 0 into 1 and 1 into 0.

Given number

1

1

0

1

1

0

1

1

1’s complement

0

0

1

0

0

1

0

0

Add 1

1

Binary

0

0

1

0

0

1

0

1

Decimal

37

Answer: (1101 1011)2 = (37)10

Answer 4:
i) Unsigned integer
Binary to Decimal Conversion
Technique

– Multiply each bit by 2n, where n is the “weight” of the bit

– The weight is the position of the bit, starting from 0 on the right

– Add the results

i)Determine the Decimal equivalent of ( 0011 1011)2


Binary   0   0   1   1   1   0   1   1     
Number                                     
                                     
Weight of   27 26   25   24   23   22   21   20     
Each Bit                                     
                                     
Weighted   0 X27   0 X26   1X25    1 X24   1 X23   0X22    1X21   1X 20     
Value                                     
Solved   0   0   32   16   8   0   2   1     
Multiplication
                                     
                                      
                                  

Sum of weight of all bits = 32+16+8+2+1=59
Answer: (0011 1011)2 = (59)10
ii) Signed integer
In case of Signed Number If MSB bit is 0 then number is Positive number and if it is 1 then number is negative number.
For given number MSB is 0 so number is positive and remaining bit give magnitude we can convert it into decimal by applying above method. Which is 59.


MSB (signed bit)   Magnitude
     
0 0111011  

Answer: (0011 1011)2 = + (59)10

iii) Two's complement integer
In this case take 2’s complement of given number and convert into decimal using above method.
For 2’s complement take 1’s complement and then add 1 into it.1’s complement means change 0 into 1 and 1 into 0.


Given number   0   0   1   1   1   0   1   1     
1’s complement   1   1   0   0   0   1   0   0     
Add 1 1     
Binary   1   1   0   0   0   1   0   1     
Decimal   197  

Answer: (0011 1011)2 = (197)10

Answer 5: The IEE 754 single precision format is given below,

Sign

Exponent

Mantissa

1bit

8bit

23bit

32bits

Step-1: Find Binary equivalent

Decimal to Binary

•           Technique

– Divide by two, keep track of the remainder

– First remainder is bit 0 (LSB, least-significant bit)

– Second remainder is bit 1

– Etc

Determine the Binary equivalent of (28)10

2

28

Remainder

Least Significant Bit ( LSB)

2

14

0

2

7

0

2

3

1

2

1

1

0

1

   Most Significant Bit ( MSB)

                                                                       

(28)10 = (11100)2

Step-2: Normalize the binary representation of the number.

                28(10) =1 1100(2)

=1 1100(2) × 20

= 1.1100(2) × 24

Step-3: Adjust the exponent.

Adjusted Exponent (Biased exponent)

                            = 127+ Exponent (unadjusted)

    = 127+4

    = (131)10

Step-4:

Related Solutions

1. What does diffraction mean? 2. When does diffraction occur? 3. When looking at an interference...
1. What does diffraction mean? 2. When does diffraction occur? 3. When looking at an interference or diffraction pattern, what does an anti-node look like? 4. When looking at an interference or diffraction pattern, what does a node look like? 5. What safety precautions are important to keep in mind while you're using a laser pointer?
1. When does a surplus occur in a market system? How is equilibrium restored? 2. When...
1. When does a surplus occur in a market system? How is equilibrium restored? 2. When does a shortage occur in a market system? How is equilibrium restored?
when does a discontinued operation occur?
when does a discontinued operation occur?
When adding two signed binary numbers , what does it mean when unsigned overflow has occured?...
When adding two signed binary numbers , what does it mean when unsigned overflow has occured? What is the result of subtracting 1000 from 0001? What, if any, overflows would occur?
1) Describe the functions of estrogen 2)Describe the hormonal changes that occur as a result of...
1) Describe the functions of estrogen 2)Describe the hormonal changes that occur as a result of implantation, including production of human chorionic gonadotropin (HCG) to maintain the corpus luteum and increased production of progesterone by the corpus luteum 3) What is luteinizing hormone? What does it do?
When does a discount on bonds payable occur?
When does a discount on bonds payable occur?
When does a premium on bonds payable occur?
When does a premium on bonds payable occur?
What is integrative bargaining? When does it occur?
What is integrative bargaining? When does it occur?
For each of the following, specify if a reaction does or does not occur when the...
For each of the following, specify if a reaction does or does not occur when the two reagents are combined, and justify your choice of reaction or no reaction. For each combination where a reaction does occur, write balanced molecular and net ionic equations for that reaction. (NH4)2CO3(aq) + MgBr2(aq) → Ni(C2H3O2)2(aq) + K3PO4(aq) → Sr(OH)2(aq) + HC2H3O2(aq) → CuSO4(aq) + Co(NO3)2(aq) → Cs2CO3(aq) + HI(aq) → Sr(OH)2(aq) + HBr(aq) → H2SO4(aq) + KOH(aq) → HCl(aq) + H2NCH2CH2NH2(aq) → HO2CCO2H(aq)...
List and briefly describe the errors that may occur with pH measurement
List and briefly describe the errors that may occur with pH measurement
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT