-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
fmt.Println fails to print math.MaxUint64 #19621
Comments
Working as intended per the language spec: https://golang.org/ref/spec#Constants https://play.golang.org/p/-TM6jBzFpV See also: https://blog.golang.org/constants |
This is just a minor confusing property of the constants defined in the math package. They are all untyped constants (see blog.golang.org/constants), so by default they promote to type |
I too was once surprised by almost the same error message, some 2 years ago https://twitter.com/odeke_et/status/664360654875267073 but @mattsiegel educated me. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?play.golang.org
What operating system and processor architecture are you using (
go env
)?play.golang.org
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/5GARX4Q2Tc
What did you expect to see?
Successful compilation and math.MaxUint64 in standard output
What did you see instead?
main.go:9: constant 18446744073709551615 overflows int
The text was updated successfully, but these errors were encountered: