Question

In: Computer Science

Write a program that converts a given floating point binary number with a 24-bit normalized mantissa...

Write a program that converts a given floating point binary number with a 24-bit normalized mantissa and an 8-bit exponent to its decimal (i.e. base 10) equivalent. For the mantissa, use the representation that has a hidden bit, and for the exponent use a bias of 127 instead of a sign bit. Of course, you need to take care of negative numbers in the mantissa also. Use your program to answer the following questions: (a) Mantissa: 11110010 11000101 01101010, exponent: 01011000. What is the base-10 number? (b) What is the largest number (in base 10) the system can represent? (c) What is the smallest non-zero positive base-10 number the system can represent? (d) What is the smallest difference between two such numbers? Give your answer in base 10. (e) How many significant base-10 digits can we trust using such a representation?

Mention: Matlab

Solutions

Expert Solution

Solution for the above question is provided below. If any doubt please comment below.

a)

%Given inputs
expnt='01011000';
mant='111100101100010101101010';

% Signbit
signBit=str2num(mant(1));

%Find mantissa
manti=mant(2:24);

% compute exponent
exponent=0;
dj=length(expnt);
for di=1:length(expnt)
   exponent=str2num(expnt(di))*2^(dj-1)+exponent;
    dj=dj-1;
end

% Find bias
ex=-127+exponent;
decim=0;

%compute the value
for di=1:length(manti)
   decim=str2num(manti(di))*2^(-di)+decim;
end

format long

% Result
res=(-1)^signBit*(1+decim)*2^(ex)

Output:

b)

To find it make exponent as all 1's and also make mantissa all as 1 except first bit in the above program

%Given inputs

expnt= '11111111';

mant='011111111111111111111111';

Output:

c)

%Given inputs

expnt= '00000000';

mant= '000000000000000000000000' ;

Output:

d)

First run the program using below mantissa and exponent

expnt='00000000';
mant='011111111111111111111111';

Second run the program using below mantissa and exponent

expnt='00000000';
mant='011111111111111111111110';

Find the difference of both result

Output:

e)

Number of significant base-10 digits = 2-23


Related Solutions

The number –11.375 (decimal) represented as a 32-bit floating-point binary number according to the IEEE 754...
The number –11.375 (decimal) represented as a 32-bit floating-point binary number according to the IEEE 754 standard is
Find the 3-bit mantissa floating point representation of the following numbers, both by chopping and rounding,...
Find the 3-bit mantissa floating point representation of the following numbers, both by chopping and rounding, and then calculate the associated respective absolute error and relative error: (a) 11/16 (b) 2.75
Q1.Convert C46C000016 into a 32-bit single-precision IEEE floating-point binary number.
Q1.Convert C46C000016 into a 32-bit single-precision IEEE floating-point binary number.
c) Using the 32-bit binary representation for floating point numbers, represent the number 1011100110011 as a...
c) Using the 32-bit binary representation for floating point numbers, represent the number 1011100110011 as a 32 bit floating point number. i) A digital camera processes the images images in the real-world and stores them in binary form. Using the principles of digital signal processing, practically explain how this phenomenon occurs.
Write a MIPS assembly language program that inputs a floating-point number and shows its internal 32-bit...
Write a MIPS assembly language program that inputs a floating-point number and shows its internal 32-bit representation as a 8-digit hexadecimal representation. For example: 2.5 decimal is 10.1 binary, which normalized is 1.01x21 and would be stored in the IEEE format as 0100 0000 0010 0000 0000 0000 0000 0000 which is 0x40200000
Convert the following floating-point number (stored using IEEE floating-point standard 754) to a binary number in...
Convert the following floating-point number (stored using IEEE floating-point standard 754) to a binary number in non-standard form. 0100_0001_1110_0010_1000_0000_0000_0000
Given the following 32-bit binary sequences representing single precision IEEE 754 floating point numbers: a =...
Given the following 32-bit binary sequences representing single precision IEEE 754 floating point numbers: a = 0100 0000 1101 1000 0000 0000 0000 0000 b = 1011 1110 1110 0000 0000 0000 0000 0000 Perform the following arithmetic and show the results in both normalized binary format and IEEE 754 single-precision format. Show your steps. a)     a + b b)     a × b
Write a program in C that takes as input an 8-bit binary number and prints the...
Write a program in C that takes as input an 8-bit binary number and prints the next 10 binary numbers. Define a binary number as int binNum[8]; Use binNum[0] to store the most significant (i.e., leftmost) bit and binNum[7] to store the least significant bit. Ask the user to input the first binary number with each bit separated by at least one space.
Assume that you have a 12-bit floating point number system, similar to the IEEE floating point...
Assume that you have a 12-bit floating point number system, similar to the IEEE floating point standard, with the format shown below and a bias of 7. The value of a floating point number in this system is represented as    FP = (-1)^S X 1.F X 2^(E-bias) for the floating point numbers A = 8.75 and B = -5.375. The binary representation of A is given as A = 0101 0000 1100 Show the hexidecimal representation of B.
Using the simple model for representing binary floating point numbers A floating-point number is 14 bits...
Using the simple model for representing binary floating point numbers A floating-point number is 14 bits in length. The exponent field is 5 bits. The significand field is 8 bits. The bias is 15 Represent -32.5010 in the simple model.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT