CS101 Assignment solution 1 by Getready|Cs101 Spring Assignment solution 2023

CS101 Assignment solution 1 by Getready|Cs101 Spring Assignment solution 2023



Assignment solution (CS101)

Assignment No. 01

Spring 2023      

 

 

Answer:

A.           Encode the (negative) decimal fraction -9/2 to binary using the 8-bit floating-point notation.

i.            The first step is to convert the decimal fraction to binary.

-9/2 = -4.5, which in binary is 100.1.

ii.           The next step is to normalize the mantissa. This means that we need to move the binary point to the left until the first bit is a 1.

In this case, we need to move the binary point one bit to the left, which gives us 0.1001.

iii.          The sign bit is 1 because the number is negative. The exponent is 0 because the binary point is not moved more than one bit to the right.

The final encoding is 1001001.





B.           Determine the smallest (lowest) negative value which can be incorporated/represented using the 8-bit floating-point notation.

i.            The smallest negative value that can be represented in 8-bit floating-point notation is -1. This is because the sign bit is 1 and the exponent is the minimum value of -127.




C.           Determine the largest (highest) positive value which can be incorporated/represented using the 8-bit floating-point notation.

The largest positive value that can be represented in 8-bit floating-point notation is 1. This is because the sign bit is 0 and the exponent is the maximum value of 127.