Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The assignment has to be writtin in the formal language C Write a member function that takes a standard float variable, converts and stores it
The assignment has to be writtin in the formal 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). Start by enforcing the limits you determined in the previous point. 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. 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). Start by enforcing the limits you determined in the previous point. 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 memberStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started