How do I save a floating-point number in 2 bytes?
Yes I'm aware of the IEEE-754 half-precision standard, and yes I'm aware of the work done in the field. Put very simply, I'm trying to save a simple floating point number (like 52.1 , or 1.25 ) in just 2 bytes. I've tried some implementations in Java and in C# but they ruin the input value by decoding a different number. You feed in 32.1 and after encode-decode you get 32.0985 . Is there ANY way I can store floating point numbers in just 16-bits without ruining the input value? Thanks very much. You could store three digits in BCD and use the remaining four bits for the decimal point position: