Question: 4.In this question you will use the data type bit32 (i.e. an unsigned int). We will use the IEEE 754 standard for floating point numbers,

4.In this question you will use the data type bit32 (i.e. an unsigned int). We will use the IEEE 754 standard for floating point numbers, with 1 sign bit, 8 bits for the exponent, and 23 bits for the mantissa.For the following programming questions, place each function in a common file fplib.c for compiling and testing. You are not to use any C floating point data types (i.e., float, double). You can use the bit wise operators as needed:and, or, not, xor, shift-right, and shift-left.

(a)Write C functions to extract the sign, exponent, and fraction of a bit32floating point number, returning their respective values as unsigned integers.The functions should be named sign, expon, and frac.

(b) Write a function, float_32(unsigned int sign, unsigned int exp, unsigned int frac), that returns a bit32 representation of a number given a sign, exponent, and fraction values as unsigned integers.

(c) Using the functions defined in (a) and (b), write a function fp_add(bit32 x, bit32y)that returns the addition of two bit32values x and y as a floating point bit32value.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!