@@ -897,8 +897,7 @@ func (v *Value) Float64() (float64, error) {
897
897
if v .Type () != TypeNumber {
898
898
return 0 , fmt .Errorf ("value doesn't contain number; it contains %s" , v .Type ())
899
899
}
900
- f := fastfloat .ParseBestEffort (v .s )
901
- return f , nil
900
+ return fastfloat .Parse (v .s )
902
901
}
903
902
904
903
// Int returns the underlying JSON int for the v.
@@ -908,9 +907,9 @@ func (v *Value) Int() (int, error) {
908
907
if v .Type () != TypeNumber {
909
908
return 0 , fmt .Errorf ("value doesn't contain number; it contains %s" , v .Type ())
910
909
}
911
- n := fastfloat .ParseInt64BestEffort (v .s )
912
- if n == 0 && v . s != "0" {
913
- return 0 , fmt . Errorf ( "cannot parse int %q" , v . s )
910
+ n , err := fastfloat .ParseInt64 (v .s )
911
+ if err != nil {
912
+ return 0 , err
914
913
}
915
914
nn := int (n )
916
915
if int64 (nn ) != n {
@@ -926,9 +925,9 @@ func (v *Value) Uint() (uint, error) {
926
925
if v .Type () != TypeNumber {
927
926
return 0 , fmt .Errorf ("value doesn't contain number; it contains %s" , v .Type ())
928
927
}
929
- n := fastfloat .ParseUint64BestEffort (v .s )
930
- if n == 0 && v . s != "0" {
931
- return 0 , fmt . Errorf ( "cannot parse uint %q" , v . s )
928
+ n , err := fastfloat .ParseUint64 (v .s )
929
+ if err != nil {
930
+ return 0 , err
932
931
}
933
932
nn := uint (n )
934
933
if uint64 (nn ) != n {
@@ -944,11 +943,7 @@ func (v *Value) Int64() (int64, error) {
944
943
if v .Type () != TypeNumber {
945
944
return 0 , fmt .Errorf ("value doesn't contain number; it contains %s" , v .Type ())
946
945
}
947
- n := fastfloat .ParseInt64BestEffort (v .s )
948
- if n == 0 && v .s != "0" {
949
- return 0 , fmt .Errorf ("cannot parse int64 %q" , v .s )
950
- }
951
- return n , nil
946
+ return fastfloat .ParseInt64 (v .s )
952
947
}
953
948
954
949
// Uint64 returns the underlying JSON uint64 for the v.
@@ -958,11 +953,7 @@ func (v *Value) Uint64() (uint64, error) {
958
953
if v .Type () != TypeNumber {
959
954
return 0 , fmt .Errorf ("value doesn't contain number; it contains %s" , v .Type ())
960
955
}
961
- n := fastfloat .ParseUint64BestEffort (v .s )
962
- if n == 0 && v .s != "0" {
963
- return 0 , fmt .Errorf ("cannot parse uint64 %q" , v .s )
964
- }
965
- return n , nil
956
+ return fastfloat .ParseUint64 (v .s )
966
957
}
967
958
968
959
// Bool returns the underlying JSON bool for the v.
0 commit comments