On Sat, Sep 24, 2011 at 1:23 PM, rkalla123 <rkalla@...
> Hmm! John, I like that idea... it is simple, singular and easy to represent.
> What would you think of something like this:
> marker: N
> length: required
> [N][121-bytes representing a UTF-8 string of my number]
> In this case the number could be a decimal or int value, but it would be up to the language parsing it to decide and return the right value.
> This fits really nicely into my "understand in under 10 mins" requirement for the spec, there is no discussion about twos-compliment this, or endianness that... it is just "Here is a huge number, as a String, marked by the letter 'N' and a length... have fun!"
> Would like to know what others thought?
I like the idea of "encoded generic number". But one of the purposes
of a binary encoding is space savings, so I don't think unicode fits
into that framework.
If I understand correctly, you only need to encode the 10 digits, and
"+", "-", "e", "E", and "."
That's only 15 items, and you can pack 16 items into every 4 bits.
Leaves you one item left over for an end marker.
You could easily pack two characters into every byte, and could define
0 to be the end marker, and define that if there are an odd number of
characters, then the number will be followed by 3 nybbles of 0, and if
there is an even number of characters, then the number will be
followed by 2 nybbles of 0. In that case, the end of number marker
will always be a byte of zero, which you can always scan for with any