File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -140,13 +140,17 @@ func ParseBestEffort(s string) float64 {
140
140
break
141
141
}
142
142
if i <= j {
143
- if strings .EqualFold (s [i :], "inf" ) {
143
+ s = s [i :]
144
+ if strings .HasPrefix (s , "+" ) {
145
+ s = s [1 :]
146
+ }
147
+ if strings .EqualFold (s , "inf" ) {
144
148
if minus {
145
149
return - inf
146
150
}
147
151
return inf
148
152
}
149
- if strings .EqualFold (s [ i :] , "nan" ) {
153
+ if strings .EqualFold (s , "nan" ) {
150
154
return nan
151
155
}
152
156
return 0
Original file line number Diff line number Diff line change @@ -190,8 +190,10 @@ func TestParseBestEffort(t *testing.T) {
190
190
// inf and nan
191
191
f ("inf" , math .Inf (1 ))
192
192
f ("-Inf" , math .Inf (- 1 ))
193
+ f ("+iNf" , math .Inf (1 ))
193
194
f ("INF" , math .Inf (1 ))
194
195
f ("nan" , math .NaN ())
196
+ f ("-nan" , math .NaN ())
195
197
f ("naN" , math .NaN ())
196
198
f ("NaN" , math .NaN ())
197
199
}
You can’t perform that action at this time.
0 commit comments