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

gccgo: invalid error message for valid conversion to complex64 #11615

Closed
dvyukov opened this issue Jul 6, 2015 · 3 comments
Closed

gccgo: invalid error message for valid conversion to complex64 #11615

dvyukov opened this issue Jul 6, 2015 · 3 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 6, 2015

gccgo rejects the following program:

package a
var a = complex64(6)/774516156475830989403545856475830078125
go.go:2:22: error: complex real part overflow

This program is legal and should be compiled without error messages.
See Robert explanation in #11590.

gcc version 6.0.0 2015070 (experimental) (GCC)

@dvyukov
Copy link
Member Author

dvyukov commented Jul 6, 2015

@paranoiacblack

@ianlancetaylor ianlancetaylor added this to the Gccgo milestone Jul 9, 2015
@ianlancetaylor
Copy link
Contributor

Interesting. The mpfr library says that the value takes 130 bits to represent. But I agree that the value can be represented, inexactly, in float64. There is something wrong with the two occurrences of "max_exp = 128" (and probably also "max_exp = 1024") in expressions.cc.

@paranoiacblack
Copy link
Contributor

I guess I'll close this for now since I find myself repeatedly looking at it. complex64 has real and imaginary parts with 32 bits each, not 64 bits each and sure enough, 774516156475830989403545856475830078125 does not fit into a float32. Seems like gccgo probably does the right thing in this case.

@golang golang locked and limited conversation to collaborators Jul 11, 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

4 participants