func ParseUfloat(buf []byte) (float64, error) {
	if len(buf) == 0 {
		return -1, errEmptyFloat
	}
	b := buf
	var v uint64
	var offset = 1.0
	var pointFound bool
	for i, c := range b {
		if c < '0' || c > '9' {
			if c == '.' {
				if pointFound {
					return -1, errDuplicateFloatPoint
				}
				pointFound = true
				continue
			}
			if c == 'e' || c == 'E' {
				if i+1 >= len(b) {
					return -1, errUnexpectedFloatEnd
				}
				b = b[i+1:]
				minus := -1
				switch b[0] {
				case '+':
					b = b[1:]
					minus = 1
				case '-':
					b = b[1:]
				default:
					minus = 1
				}
				vv, err := ParseUint(b)
				if err != nil {
					return -1, errInvalidFloatExponent
				}
				return float64(v) * offset * math.Pow10(minus*int(vv)), nil
			}
			return -1, errUnexpectedFloatChar
		}
		v = 10*v + uint64(c-'0')
		if pointFound {
			offset /= 10
		}
	}
	return float64(v) * offset, nil
}
func ParseUfloat(buf []byte) (float64, error) {
	if len(buf) == 0 {
		return -1, errEmptyFloat
	}
	b := buf
	var v uint64
	var offset = 1.0
	var pointFound bool
	for i, c := range b {
		if c < '0' || c > '9' {
			if c == '.' {
				if pointFound {
					return -1, errDuplicateFloatPoint
				}
				pointFound = true
				continue
			}
			if c == 'e' || c == 'E' {
				if i+1 >= len(b) {
					return -1, errUnexpectedFloatEnd
				}
				b = b[i+1:]
				minus := -1
				switch b[0] {
				case '+':
					b = b[1:]
					minus = 1
				case '-':
					b = b[1:]
				default:
					minus = 1
				}
				vv, err := ParseUint(b)
				if err != nil {
					return -1, errInvalidFloatExponent
				}
				return float64(v) * offset * math.Pow10(minus*int(vv)), nil
			}
			return -1, errUnexpectedFloatChar
		}
		v = 10*v + uint64(c-'0')
		if pointFound {
			offset /= 10
		}
	}
	return float64(v) * offset, nil
}
func ParseUfloat ( buf [ ] byte ) ( float64 , error ) { if len ( buf ) == 0 { return - 1 , errEmptyFloat } b := buf var v uint64 var offset = 1.0 var pointFound bool for i , c := range b { if c < '0' || c > '9' { if c == '.' { if pointFound { return - 1 , errDuplicateFloatPoint } pointFound = true continue } if c == 'e' || c == 'E' { if i + 1 >= len ( b ) { return - 1 , errUnexpectedFloatEnd } b = b [ i + 1 : ] minus := - 1 switch b [ 0 ] { case '+' : b = b [ 1 : ] minus = 1 case '-' : b = b [ 1 : ] default : minus = 1 } vv , err := ParseUint ( b ) if err != nil { return - 1 , errInvalidFloatExponent } return float64 ( v ) * offset * math . Pow10 ( minus * int ( vv ) ) , nil } return - 1 , errUnexpectedFloatChar } v = 10 * v + uint64 ( c - '0' ) if pointFound { offset /= 10 } } return float64 ( v ) * offset , nil }
// ParseUfloat parses unsigned float from buf.
ParseUfloat parses unsigned float from buf .