diff --git a/pkg/schema/field/number.go b/pkg/schema/field/number.go index 68e765784e70606bc9d9a92069c417d9d25a28c7..56a8f0b5ec96139b6e8ce37d6f475545f0132fe9 100644 --- a/pkg/schema/field/number.go +++ b/pkg/schema/field/number.go @@ -10,8 +10,8 @@ import ( const ( NumberFormatInt = "int" NumberFormatFloat = "float" - maxInt = 1<<53 - 1 // Integers from в€’9,007,199,254,740,992 to 9,007,199,254,740,992 can be exactly represented in float64. - minInt = -1<<53 + 1 // Integers from в€’9,007,199,254,740,992 to 9,007,199,254,740,992 can be exactly represented in float64. + maxInt = 1<<53 - 1 // Integers from в€’9,007,199,254,740,991 to 9,007,199,254,740,991 can be exactly represented in float64. + minInt = -1<<53 + 1 ) var numberType = &NumberType{} diff --git a/pkg/schema/field/number_test.go b/pkg/schema/field/number_test.go index aaac5462056b28f7d91ef2e706ae094f775cf564..797091669c780b422238866453d30d592de34a24 100644 --- a/pkg/schema/field/number_test.go +++ b/pkg/schema/field/number_test.go @@ -25,8 +25,7 @@ func TestNumberField_Decode(t *testing.T) { {"maxInt in float", Number(NumberFormatInt), float64(maxInt), int64(maxInt), false}, // #8 {"minInt in float", Number(NumberFormatInt), float64(minInt), int64(minInt), false}, // #9 {"Convert error", Number(NumberFormatInt), math.MaxFloat64, nil, true}, // #10 - {"Convert error", Number(NumberFormatInt), -9223372036854776000.0, nil, true}, // #11 - {"Convert error", Number(NumberFormatInt), 9223372036854776000.0, nil, true}, // #12 + {"Convert error", Number(NumberFormatInt), -math.MaxFloat64, nil, true}, // #11 {"Convert error", Number(NumberFormatInt), float64(math.MaxInt64), nil, true}, // #13 {"Convert error", Number(NumberFormatInt), float64(math.MinInt64), nil, true}, // #14