Representing Decimals (floats) in REBin?
The question has come up as to how to best represent decimal values with the REBOL Binary encoded format, REBin.
This is tricky because we want machine indpendence, but we also want optimal size. In other words, if we use the IEEE floating point format (that we use for REBOL internally), then each decimal value would require 8 bytes, even if the value is simply 1.0. Of course, it would load really fast (no conversion), but is IEEE FP compatible in binary form between all processors and libraries?
An alternative would be to use text format, but we might want to do some minor rounding to prevent the problem where 2.0 becomes 1.999999999999. Another method would be BCD (binary coded decimal) encoding of the text format.
If you have suggestions on this problem, please contact me via REBOL feedback or on AltME. Thanks.