Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anthonyfok opened this issue Oct 19, 2021 · 0 comments

Comments

@anthonyfok
Copy link

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!

casualjim added a commit that referenced this issue Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant