You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gotype rejects both assignments.
gc rejects only the first one with "constant 1 truncated to integer", but accepts the second one.
The spec says:
This rounding may cause a floating-point constant expression to be invalid in an integer context, even if it would be integral when calculated using infinite precision.
http://golang.org/ref/spec#Constant_expressions
But it does not say the opposite -- FP const may be valid in int context, even if it is not integral when calculated using infinite precision. I think it should say so.
The second point is that "constant 1 truncated to integer" error does not make sense.
The text was updated successfully, but these errors were encountered:
The program is:
gotype rejects both assignments.
gc rejects only the first one with "constant 1 truncated to integer", but accepts the second one.
The spec says:
http://golang.org/ref/spec#Constant_expressions
But it does not say the opposite -- FP const may be valid in int context, even if it is not integral when calculated using infinite precision. I think it should say so.
The second point is that "constant 1 truncated to integer" error does not make sense.
The text was updated successfully, but these errors were encountered: