As part of a data storage project, I am storing floats in 3 byte ints as
follows:
* First 21 bits represent number
* Last 3 bits represent the number of decimal places
I need to write macros that will convert TO/FROM THREE_BYTE_VALU E and float
#define FLOAT_TO_TBV(fv al,prec) //may need some input checks to make
sure no overflows
#define TBV_TO_FLOAT(bv al, prec) // checks needed here to
Any ideas how to implement this (especially with the overflow checks)?
follows:
* First 21 bits represent number
* Last 3 bits represent the number of decimal places
I need to write macros that will convert TO/FROM THREE_BYTE_VALU E and float
#define FLOAT_TO_TBV(fv al,prec) //may need some input checks to make
sure no overflows
#define TBV_TO_FLOAT(bv al, prec) // checks needed here to
Any ideas how to implement this (especially with the overflow checks)?
Comment