Possible Duplicate:
32-bit to 16-bit Floating Point Conversion
How do I convert between 32-bit floats and 16-bit half-precision floats in C?
Possible Duplicate:
32-bit to 16-bit Floating Point Conversion
How do I convert between 32-bit floats and 16-bit half-precision floats in C?
I suggest you checking up this half_floats
You should also think about the way you will store these half-floats (there is no such type in C)
Since C typically doesn't have a 16-bit floating point type built-in, I would expect you would either have to
unsigned short
. This will be portable, but might be a lot slower.Both of these assume all you want to do is build the value's representation, you can't do arithmetic using C's operators of course.