2
0

added NaN support to Numeric.Set

This commit is contained in:
leighhopcroft
2020-06-02 18:35:58 +01:00
parent 9d847241cb
commit 3cbb81631a
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -64,12 +64,18 @@ func (dst *Numeric) Set(src interface{}) error {
switch value := src.(type) {
case float32:
if math.IsNaN(float64(value)) {
return nil
}
num, exp, err := parseNumericString(strconv.FormatFloat(float64(value), 'f', -1, 64))
if err != nil {
return err
}
*dst = Numeric{Int: num, Exp: exp, Status: Present}
case float64:
if math.IsNaN(value) {
return nil
}
num, exp, err := parseNumericString(strconv.FormatFloat(value, 'f', -1, 64))
if err != nil {
return err