MCPcopy Index your code
hub / github.com/dunglas/httpsfv / parseDecimal

Function parseDecimal

decimal.go:44–64  ·  view source on GitHub ↗
(s *scanner, decSepOff int, str string, neg bool)

Source from the content-addressed store, hash-verified

42}
43
44func parseDecimal(s *scanner, decSepOff int, str string, neg bool) (float64, error) {
45 if decSepOff == s.off-1 {
46 return 0, &UnmarshalError{s.off, ErrInvalidDecimalFormat}
47 }
48
49 if len(s.data[decSepOff+1:s.off]) > maxDecDigit {
50 return 0, &UnmarshalError{s.off, ErrNumberOutOfRange}
51 }
52
53 i, err := strconv.ParseFloat(str, 64)
54 if err != nil {
55 // Should never happen
56 return 0, &UnmarshalError{s.off, err}
57 }
58
59 if neg {
60 i = -i
61 }
62
63 return i, nil
64}

Callers 1

parseNumberFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…