(s *scanner, decSepOff int, str string, neg bool)
| 42 | } |
| 43 | |
| 44 | func 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…