程序代写代做 You are to implement binary floating point operations for MyFloat such as addition, subtraction, multiplication, division, and reciprocal.

You are to implement binary floating point operations for MyFloat such as addition, subtraction, multiplication, division, and reciprocal.
To add floating point numbers you should align their mantissas and add the numbers. If there is an overflow of the mantissa you should increase the exponent of the result. Lazy implementations that normalize the floating point numbers to the same exponent and add the shifted mantissa are perfectly valid. Remember to include the implied bit when you do it. Numbers that are too big or too small will not change after addition. Do not worry about rounding.
To multiply floating point numbers you should add their exponent and then integer multiply their mantissas. Remember to include the implied bit when you do it.
To divide floating point numbers you should subtract their exponents and then integer divide their mantissas. Remember to include the implied bit when you do it.
To invert a floating point number you should subtract the exponent from the exponent of 1.0 and you should integer divide 1.0’s mantissa (with implied) by your number you are inverting. Remember to include the implied bit when you do it.
You must create a function myfloat_add() that takes two MyFloat, adds them, and returns the result as a MyFloat.
You must create a function myfloat_sub() that takes two MyFloat, subtracts them, and returns the result as a MyFloat. It’s easiest to just flip the sign of the second argument, and then call your own myfloat_add to do this.
You must create a function myfloat_mul() that takes two MyFloat, multiplies them, and returns the result as a MyFloat.
You must create a function myfloat_inv() that takes a MyFloat, and returns its reciprocal (1/x).
You must create a function myfloat_div() that takes two MyFloat, divides them, and returns the result as a MyFloat.
It’s easiest to just call your own code and multiply the first argument by the reciprocal of the second argument.
********************* Myfloat_ops.c

******************** */
#include “myfloat_ops.h” #include #include #include #include #include
/* */
*************************************
Myfloat_ops.h
*************************************
Finish this header to get question2_test.c working.
*/ /* */
#include “myfloat.h”
MyFloat myfloat_add(MyFloat, MyFloat); MyFloat myfloat_sub(MyFloat, MyFloat); MyFloat myfloat_mul(MyFloat, MyFloat); MyFloat myfloat_inv(MyFloat);
MyFloat myfloat_div(MyFloat, MyFloat); /* */