I would like to convert an int to a 32-bit value (as an IEEE floating point value). I've never done C before so this is pretty confusing. I read somewhere that using the & mask would be a good way but I have no clue how to even start!
Thanks for any tips or pointers
Is there a reason why you don't do
int foo = 16384;
float bar = foo;
If "float" is a 32-bit IEEE value, then of course, but the language doesn't guarantee it.
Originally Posted by tabstop
Of course, if the system doesn't use IEEE floats then why are we bothering to make one?
If the answer is "because the assignment is to do so", then we can start talking about bit masks. On the other hand, bitwise math doesn't change from language to language so far as I know, so your knowledge of Java or whatever other language you've learned should be fine here. (And if you've managed to talk your way into a course where the first assignment is to build an IEEE float and you have no programming experience, then I admire your sweet-talking skills, but that doesn't really help you here.)