You have a combination of things that are acting against you.
float simulated_fp_add(float, float);
c = simulated_fp_add( a, b );
u.f = c;
You are calling a function that takes floats with integer values of floating point bit patterns. These are being converted to (garbage) floating point values before the call is made, which is probably not what you intended.
You are converting the return value of simulated_fp_add()
to an unsigned int (c) and then converting that back to a float (u.f).
Finally, simulated_fp_add()
does a logical shift right on a value that will be interpreted as float. The effect of this is unpredictable, but is likely to give you a subnormal floating point value that will be rounded down to zero in the above integer conversion.
You should start by writing an extremely small piece of code, testing it, and then building on it. Start with something like this:
unsigned int shift(unsigned int a);
int main() {
unsigned int a, c;
a = 5;
printf("a = %0x\n", a);
c = shift(a);
printf("c = %0x\n", c);
return 0;
}