I need to store values in a range of about -10000 to 10000. At the range borders, the precision needed is not very high (maybe about 64, I will see how it fits), around zero the precision needs to be 1 or better.
Unfortunately space is very limited, not more than 12 bits, less would even be better. So strictly speaking, even half floats are out. Is there an open source library which handles some very short float formats with short mantissa and exponent length? Like 8 bit mantissa and 3 bit exponent.
Only conversion from/to bigger formats is required, no arithmetic is done.
If you're not doing any computation, then there's barely a need for a library. frexp
, ldexp
and some bit-twiddling should do the job.
Perhaps μ-law or A-law could be useful for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With