From 61fe4b5a95e2b2db653741d9179c979b5fd5b51f Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Thu, 5 Oct 2023 15:52:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=9F=D0=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/schema/field/number.go | 4 ++-- pkg/schema/field/number_test.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/schema/field/number.go b/pkg/schema/field/number.go index 68e76578..56a8f0b5 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 aaac5462..79709166 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 -- GitLab