The ieeehalfprecision.c file from the matlab package covers all possible
half values quickly and efficiently, using only type punning to integers,
bit comparisons ( and the like) and bit shifts. The licence is BSD and
the api is super simple:
int singles2halfp(void *target, void *source, int
Likewise, GraphicsMagick includes work by Richard Nolde which knows
how to handle 16 and 24 bit floats. He actually wrote a full
conversion suite between 16, 24, 32, and 64-bit floats. I only
incorporated the specific functions that GraphicsMagick needs. This
code has been in GraphicsMagick