On Mon, Feb 24, 2014 at 7:43 PM, Paul "LeoNerd" Evans <leon...@leonerd.org.uk> wrote: > On Mon, 24 Feb 2014 19:14:48 +0000 > Ben Hood <0x6e6...@gmail.com> wrote: > >> So I have a question about the encoding of 0: \x00\x00\x00\x00\x00. > > The first four octets are the decimal shift (0), and the remaining ones > (one in this case) encode a varint - 0 in this case. So it's > > 0 * 10**0 > > literally zero. > > Technically the decimal shift matters not for zero - any four bytes > could be given as the shift, ending in \x00, but 0 is the simplest.
OK, that makes sense. I was getting confused by the Go API for decimals, which doesn't let you set the scale to 0 (because it results in / by 0 error). So I'll have to look into that particular API a bit further.