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

cmd/6g: incorrect rounding of float32/float64 to uint64 conversion #3804

Closed
minux opened this issue Jul 6, 2012 · 2 comments
Closed

cmd/6g: incorrect rounding of float32/float64 to uint64 conversion #3804

minux opened this issue Jul 6, 2012 · 2 comments

Comments

@minux
Copy link
Member

minux commented Jul 6, 2012

according to go_spec, it should always truncate, but it's not the case for
float32/flaot64->uint64 conversion
on amd64:
http://play.golang.org/p/OXtuDyEfBm

related discussion thread:
https://groups.google.com/group/golang-nuts/browse_thread/thread/9f60e5466325189d
@minux
Copy link
Member Author

minux commented Jul 6, 2012

Comment 1:

a quick fix: http://golang.org/cl/6352079/

@minux
Copy link
Member Author

minux commented Aug 23, 2012

Comment 2:

This issue was closed by revision e80f6a4.

Status changed to Fixed.

minux added a commit that referenced this issue May 11, 2015

Verified

This commit was signed with the committer’s verified signature.
myitcv Paul Jolly
««« backport 5972fe3f4418
cmd/6g: fix float32/64->uint64 conversion
    CVTSS2SQ's rounding mode is controlled by the RC field of MXCSR;
as we specifically need truncate semantic, we should use CVTTSS2SQ.

    Fixes #3804.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6352079

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

2 participants