-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
Currently, the math package show the constants values for all except for max and min integer values (MaxIntXxx, MaxUintXxx, MinIntXxx,and MinUintXxx).
Usually developer get each values of max and min integers manually (by writing some script), or view it through /ref/spec [1], or search in internet.
The idea is to allow developer to check and/or copy their values through godoc.
What did you expect to see?
const (
MaxInt = 1<<(intSize-1) - 1 // Equal to MaxInt32 on 32-bit or MaxInt64 on 64-bit.
MinInt = -1 << (intSize - 1) // Equal to MinInt32 on 32-bit or MinInt64 on 64-bit.
MaxInt8 = 1<<7 - 1 // 127
MinInt8 = -1 << 7 // -128
MaxInt16 = 1<<15 - 1 // 32767
MinInt16 = -1 << 15 // -32768
MaxInt32 = 1<<31 - 1 // 2147483647
MinInt32 = -1 << 31 // -2147483648
MaxInt64 = 1<<63 - 1 // 9223372036854775807
MinInt64 = -1 << 63 // -9223372036854775808
MaxUint = 1<<intSize - 1 // Equal to MaxUint32 on 32-bit or MaxUint64 on 64-bit.
MaxUint8 = 1<<8 - 1 // 255
MaxUint16 = 1<<16 - 1 // 65535
MaxUint32 = 1<<32 - 1 // 4294967295
MaxUint64 = 1<<64 - 1 // 18446744073709551615
)
What did you see instead?
const (
MaxInt = 1<<(intSize-1) - 1
MinInt = -1 << (intSize - 1)
MaxInt8 = 1<<7 - 1
MinInt8 = -1 << 7
MaxInt16 = 1<<15 - 1
MinInt16 = -1 << 15
MaxInt32 = 1<<31 - 1
MinInt32 = -1 << 31
MaxInt64 = 1<<63 - 1
MinInt64 = -1 << 63
MaxUint = 1<<intSize - 1
MaxUint8 = 1<<8 - 1
MaxUint16 = 1<<16 - 1
MaxUint32 = 1<<32 - 1
MaxUint64 = 1<<64 - 1
)
sten4eg and jonasknobloch
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.