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
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 6, 2013

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

@griesemer griesemer commented Mar 7, 2014

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.

Loading

@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 added this to the Unreleased milestone Apr 14, 2015
@rsc rsc removed this from the Unplanned milestone 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

@griesemer griesemer commented Sep 15, 2015

See also #12576.

Loading

@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Oct 20, 2015

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

Loading

@griesemer griesemer closed this Oct 20, 2015
@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants