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
In all non-constant conversions involving floating-point or complex values, if the result type cannot represent the value the conversion succeeds but the result value is implementation-dependent.
That's the case here. You're converting 1<<63 to int64 and it doesn't quite fit.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Calling
math.Abs(math.MinInt64)
then converting to an int64 doesn't overflow on mac silicon.https://play.golang.org/p/xAYEJonoDAW
I'm not sure if this is a bug or something specific to the Silicon architecture.
What did you expect to see?
I was expecting the int64 to overflow and be negative. This is important to detect overflows and return a proper error when that happens.
What did you see instead?
The number doesn't overflow and stays positive
The text was updated successfully, but these errors were encountered: