{{ message }}
/ go Public

# math: show values of MaxXxx and MinXxx on documentation #51282

Open
opened this issue Feb 20, 2022 · 1 comment
Open

# math: show values of MaxXxx and MinXxx on documentation #51282

opened this issue Feb 20, 2022 · 1 comment
Labels
Documentation NeedsInvestigation

### shuLhan commented Feb 20, 2022

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 , 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
)
``````

### gopherbot commented Feb 20, 2022

 Change https://go.dev/cl/343990 mentions this issue: `math: show the value of each max and min integer constants in comments`