If precision is too large, encode decimal allocates large amount of memory. This commit set cast decimal unspecified length to default decimal length (10), also add check on precision and frac on `MyDecimal.ToBin`.