Question: In the programming language C, write a member function that takes a standard float variable, converts and stores it in your representation. As we are
In the programming language C, write a member function that takes a standard float variable, converts and stores it in your representation. As we are simplifying here, you are allowed to use any standard C float and int operations (divisions, modulo, typecasting). Steps - Start by enforcing limits #define EXPONENT_BITS 5 && #define FRACTION_BITS 7 - Convert the whole part of the number to a short int and write it as a binary number into a character array (e.g., using snprintf). - Convert the fractional part to a binary fraction and write it into the same array, while keeping track of where the binary dot should be. - Convert the mantissa to cannonical form and calculate the value of the exponent. Using bit shifting and bitwise OR/AND operations, write the corresponding values from the character array into the data member.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
