Question: In C++ Assignment You will write the functions prototyped above: 1. Decode will take a 32-bit number in IEEE-754 format and convert it into a
In C++ Assignment You will write the functions prototyped above: 1. Decode will take a 32-bit number in IEEE-754 format and convert it into a Real structure. 2. Encode will take a Real structure and convert it into a 32-bit number in IEEE-754 format. 3. Normalize will manipulate the exponent and fraction until the number is 1.. 4. Multiply will multiply two Real structures together and return the result as a Real structure. Multiply is the reason you're using 64-bit data types in the Real structure. 5. Add will add two Real structures together and return the result as a Real structure. Hints 1. Do not confuse two's complement with the storage format. In order to add a negative number, it must be in two's complement format, otherwise your function will have no idea that it is negative. 2. You must manually implement two's complement. IEEE-754 doesn't store in two's complement format, so you're required to manually intervene. 3. You only need to implement 32-bit IEEE-754. 4. Even though the program is dealing with floats, you will only be manipulating them as 32-bit integers. Examples ./lab3 10 x 2.53 10.000 x 2.530 = 25.300 (0x41ca6666) ./lab3 72.5 + 12.25 72.500 + 12.250 = 84.750 (0x42a98000) Restrictions 1. Warnings might be as bad as errors. The -Werror below will ensure that all warnings are considered errors. You may remove this switch until you test your code for submission. However, when you submit, there must be no warnings or errors! 2. You must format and comment your code, like you did in COSC102, including a header, any TA or student who helped you, and inline-code comments. 3. You must use logical, bitwise operators to perform binary arithmetic for both Multiply and Add. No arithmetic operators are permitted: +, -, *, /, %. Furthermore, comparison and boolean operators are not permitted: &&, ||, ! 4. You may NOT use any floating point data types in any of your functions. You must manually manipulate the floating point numbers stored in IEEE-754 format.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
