Navigation Menu

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

math/big: TestFloatSetFloat64String uses meaningless -0 floating point constant #19673

Closed
ianlancetaylor opened this issue Mar 23, 2017 · 1 comment
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

Go floating point constants do not support negative zero (or other IEEE-695 features). Despite that, there are several tests in TestFloatSetFloat64String in math/big/floatconv_test.go that use -0 as a constant value. If I change all instances of a constant -0 to simply 0, the test still passes. So the test as written is somewhat misleading.

For example, the test includes these cases

		{"0", 0},
		{"-0", -0},
		{"+0", 0},

which make it look like "-0" produces a different result than "+0". And maybe it does, but this test does not test that, as replacing the -0 constant with 0 does not affect the test.

@ianlancetaylor ianlancetaylor added this to the Go1.9Maybe milestone Mar 23, 2017
@bradfitz bradfitz added the Testing An issue that has been verified to require only test changes, not just a test failure. label Mar 23, 2017
@gopherbot
Copy link

CL https://golang.org/cl/38463 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

4 participants