func parseBinaryDecimal(ann []Symbol, lengthByte byte, r io.Reader) (Value, error) {
	// Represents 0d0.
	if lengthByte == 0 {
		return Decimal{annotations: ann, isSet: true, binary: []byte{}}, nil
	}

	numBytes, errLength := determineLength16(lengthByte, r)
	if errLength != nil {
		return nil, errors.WithMessage(errLength, "unable to parse length of decimal")
	}

	// Read in the entirety of the Decimal value from the stream, then farm out those
	// bytes to read the exponent and coefficient to ensure that we have a valid decimal.
	data := make([]byte, numBytes)
	if n, err := r.Read(data); err != nil || n != int(numBytes) {
		return nil, errors.Errorf("unable to read decimal - read %d bytes of %d with err: %v", n, numBytes, err)
	}

	dataReader := bytes.NewReader(data)
	expBytes, errExp := readVarNumber(numBytes, dataReader)
	if errExp != nil {
		return nil, errors.WithMessage(errExp, "unable to read exponent part of decimal")
	}

	coefficientLength := numBytes - uint16(len(expBytes))
	if coefficientLength <= 0 {
		return nil, errors.Errorf("invalid decimal - total length %d with exponent length %d", numBytes, len(expBytes))
	}

	return Decimal{annotations: ann, isSet: true, binary: data}, nil
}
// parseBinaryDecimal parses a variable length Decimal with exponent and coefficient components.
parseBinaryDecimal parses a variable length Decimal with exponent and coefficient components.
// parseBinaryDecimal parses a variable length Decimal with exponent and coefficient components .
func parseBinaryDecimal(ann []Symbol, lengthByte byte, r io.Reader) (Value, error) {
	if lengthByte == 0 {
		return Decimal{annotations: ann, isSet: true, binary: []byte{}}, nil
	}
	numBytes, errLength := determineLength16(lengthByte, r)
	if errLength != nil {
		return nil, errors.WithMessage(errLength, "unable to parse length of decimal")
	}
	data := make([]byte, numBytes)
	if n, err := r.Read(data); err != nil || n != int(numBytes) {
		return nil, errors.Errorf("unable to read decimal - read %d bytes of %d with err: %v", n, numBytes, err)
	}
	dataReader := bytes.NewReader(data)
	expBytes, errExp := readVarNumber(numBytes, dataReader)
	if errExp != nil {
		return nil, errors.WithMessage(errExp, "unable to read exponent part of decimal")
	}
	coefficientLength := numBytes - uint16(len(expBytes))
	if coefficientLength <= 0 {
		return nil, errors.Errorf("invalid decimal - total length %d with exponent length %d", numBytes, len(expBytes))
	}
	return Decimal{annotations: ann, isSet: true, binary: data}, nil
}
func parseBinaryDecimal ( ann [ ] Symbol , lengthByte byte , r io . Reader ) ( Value , error ) { if lengthByte == 0 { return Decimal { annotations : ann , isSet : true , binary : [ ] byte { } } , nil } numBytes , errLength := determineLength16 ( lengthByte , r ) if errLength != nil { return nil , errors . WithMessage ( errLength , " " ) } data := make ( [ ] byte , numBytes ) if n , err := r . Read ( data ) ; err != nil || n != int ( numBytes ) { return nil , errors . Errorf ( " " , n , numBytes , err ) } dataReader := bytes . NewReader ( data ) expBytes , errExp := readVarNumber ( numBytes , dataReader ) if errExp != nil { return nil , errors . WithMessage ( errExp , " " ) } coefficientLength := numBytes - uint16 ( len ( expBytes ) ) if coefficientLength <= 0 { return nil , errors . Errorf ( " " , numBytes , len ( expBytes ) ) } return Decimal { annotations : ann , isSet : true , binary : data } , nil }
parseBinaryDecimal parses a variable length Decimal with exponent and coefficient components.
parseBinaryDecimal parses a variable length Decimal with exponent and coefficient components .
// Represents 0d0. // Read in the entirety of the Decimal value from the stream, then farm out those // bytes to read the exponent and coefficient to ensure that we have a valid decimal.