https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63812
Ian Lance Taylor <ian at airs dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Ian Lance Taylor <ian at airs dot com> ---
This kind of thing is implementation dependent. Different implementations
handle floating point constants differently, and it can lead to this kind of
issue. This is documented in the language spec: see the "implementation
restriction" at the bottom of this section in the spec:
http://golang.org/ref/spec#Constant_expressions .
I don't know what your original code looks like, but the simple fix for your
test case is to change
int64(2.22*1000000000000000)
(which is 2.22*1e15) to
int64(222*1e13)
(or int64(222*(1e15/100)) )
Or, for a value like this that is in range for float64, you can force the the
floating point value to be typed, and write
int64(float64(2.22*1e15))