Skip to content

TestIsFloat64AJSONInteger fails now that Go 1.17 has corrected math.SmallestNonzeroFloat64 #59

@anthonyfok

Description

@anthonyfok

Running go test ./... with Go 1.17 with the following error:

--- FAIL: TestIsFloat64AJSONInteger (0.00s)
    convert_test.go:212: 
        	Error Trace:	convert_test.go:212
        	Error:      	Should be false
        	Test:       	TestIsFloat64AJSONInteger

on line 212 of convert_test.go:

assert.False(t, IsFloat64AJSONInteger(math.SmallestNonzeroFloat64/2))

It turns out that math.SmallestNonzeroFloat64 / 2 is supposed to return 0 (hence an integer), but before Go 1.17, the value of math.SmallestNonzeroFloat64 was not sufficiently precise, thus returning a non-zero non-integer.

Please see:

for more information.

Many thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions