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

go/types: negative float constants close to 0 should become -0 floats when converting to IEEE and underflow occurs #6898

Closed
griesemer opened this issue Dec 6, 2013 · 3 comments

Comments

@griesemer
Copy link
Contributor

x := -1e-10000

(or similar) should probably be materialized as a -0.0.

Check if the case.

Also, this might require a spec clarification.
@griesemer
Copy link
Contributor Author

Comment 2:

The spec leaves the behavior open since x := -1e10000 is equivalent to var x =
float64(-1e10000) :
"In all non-constant conversions involving floating-point or complex values, if the
result type cannot represent the value the conversion succeeds but the result value is
implementation-dependent."
For the reference, gccgo produces -0 in this case.

@griesemer griesemer self-assigned this Mar 7, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title go.tools/go/types: negative float constants close to 0 should become -0 floats when converting to IEEE and underflow occurs x/tools/go/types: negative float constants close to 0 should become -0 floats when converting to IEEE and underflow occurs Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@griesemer griesemer changed the title x/tools/go/types: negative float constants close to 0 should become -0 floats when converting to IEEE and underflow occurs go/types: negative float constants close to 0 should become -0 floats when converting to IEEE and underflow occurs Jul 31, 2015
@griesemer
Copy link
Contributor Author

See also #12576.

@griesemer
Copy link
Contributor Author

Per #12576 there are no -0 floating-point constants.

@golang golang locked and limited conversation to collaborators Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants