Skip to content

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

@ianlancetaylor

Description

@ianlancetaylor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeTestingAn issue that has been verified to require only test changes, not just a test failure.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions