I have a tuple T, consisting of
- An integer id in range [1, 70 × 106]
- A double score1 in range [0.0, 1.0]
- A double score2 in range [0.0, 1.0]
- An integer x in range [0, 2]
What can be the most efficient way to store such tuple T = < id, score1, score2, x > given that only 5 digits after the decimal are sufficient for score1 and score2.
Currently, I am storing this tuple as a long. 24 bits for id, 17 bits for score1, 17 bits for score2 (considering values upto 5 decimal digits), and 2 bits for x, Overall 60 bits.
I'm trying to optimize the memory usage as there are millions of such tuples in an array. Also, If your way can store digits more than 5 decimal places, please tell me.
Is there a way, by which we can store the tuple T using float? given that if the tuple is hashed to float, I should be able to get back id, x accurately and score1, score2 without much errors.
Thanks for your time, have a nice day.