code: func EncodeDecimal(b []byte, dec *types.MyDecimal, precision, frac int) ([]byte, error) {
  	if precision == 0 {
  		precision, frac = dec.PrecisionAndFrac()
  	}
  	b = append(b, byte(precision), byte(frac))
  	bin, err := dec.ToBin(precision, frac)
  	b = append(b, bin...)
  	return b, errors.Trace(err)
  }
docs: // EncodeDecimal encodes a decimal into a byte slice which can be sorted lexicographically later.