Skip to content

math: MaxUint64 doesn't return correct result but an error? #38723

@IIvyPy

Description

@IIvyPy

What version of Go are you using (go version)?

$ go@1.12

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

$ amd64

What did you do?

I just use the const in math packge: math.MaxUint64

What did you expect to see?

18446744073709551615

What did you see instead?

./main.go:169:29: constant 18446744073709551615 overflows uint

Notice that "1<<64" in "math.MaxUint64 = 1<<64 - 1" may cause overflow, perhas you can use "math.MaxUint64 = ^uint64(0)" instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions