Skip to content

Commit 8a1e868

Browse files
author
Gleb Brozhe
committed
refactor after PR review
1 parent 07d827e commit 8a1e868

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/decimal/decimal.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,21 @@ func Parse(s string, precision, scale uint32) (*big.Int, error) {
111111
}
112112

113113
func setSpecialValue(s string, v *big.Int) (string, bool, *big.Int) {
114+
s, neg := parseSign(s)
115+
116+
return parseSpecialValue(s, neg, v)
117+
}
118+
119+
func parseSign(s string) (string, bool) {
114120
neg := s[0] == '-'
115121
if neg || s[0] == '+' {
116122
s = s[1:]
117123
}
124+
125+
return s, neg
126+
}
127+
128+
func parseSpecialValue(s string, neg bool, v *big.Int) (string, bool, *big.Int) {
118129
if isInf(s) {
119130
if neg {
120131
return s, neg, v.Set(neginf)

0 commit comments

Comments
 (0)