Ok, I need to write a floating point binary program with an out put that looks like this:
Code:
Signed bit = x
2nd part = xxxxxxxx
3rd part = xxxxxxxxxxxxxxxxxxxxxxx
the 2nd part is the exponent and the 3rd is the mantissa.
I'm cheating a bit on it by using an if statement to derive the signed bit, so i only need two arrays, and less variables (i think):
Code:
int x;
scanf("%f",x);
if(x < 0){
signed = 0;
}
else{signed=1;}
ok, that's just a snippet, and its within a while loop, but you get the point. The problem i'm having isn't really code based, though any help with that is appreciated. My main problem is that i don't understand floating point binary very well. how the exponent and mantissa are derived from the original decimal number. I've looked at tutorials online but they were still a bit confusing, and my professor spends more time browsing the web or sleeping than he does teaching. Can anyone break it down simply for me? I understand converting decimal to bin, but i've never done it with floating point numbers, only integers. Please help.