Is there a way to convert a float
to an unsigned char fbytes[8]
such that:
If float value f1 < f2
, then fbytes1[i]
should NEVER be greater than fbytes2[i]
for 0 <= i <= 7
?
The intention behind this is to serialize and store a floating point number and still be able to do comparisons by comparing byte by byte. E.g. even if the float is stored as raw bytes, I can sort rows by simple byte comparison and still preserve order.