Decode: fix panic when parsing '0' as a float (#887)

Fixes #886
This commit is contained in:
Haiyang Wang
2023-08-23 00:07:39 +08:00
committed by GitHub
parent f7d9b9ba53
commit bb026cae89
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -240,6 +240,11 @@ func TestUnmarshal_Floats(t *testing.T) {
input: `0E0`,
expected: 0.0,
},
{
desc: "float zero without decimals",
input: `0`,
expected: 0.0,
},
{
desc: "float fractional with exponent",
input: `6.626e-34`,