Heesung Yang
[GO] Integer 타입 최소/최대값
- GO playground : https://go.dev/play/p/UoBkR10QmNc
- Official Reference : https://go.dev/ref/spec#Numeric_types
package main
import (
"fmt"
"math"
)
func main() {
fmt.Printf("int : %d ~ %d\n", math.MinInt, math.MaxInt)
fmt.Printf("int8 : %d ~ %d\n", math.MinInt8, math.MaxInt8)
fmt.Printf("int16 : %d ~ %d\n", math.MinInt16, math.MaxInt16)
fmt.Printf("int32 : %d ~ %d\n", math.MinInt32, math.MaxInt32)
fmt.Printf("int64 : %d ~ %d\n", math.MinInt64, math.MaxInt64)
fmt.Printf("uint : 0 ~ %d\n", uint64(math.MaxUint))
fmt.Printf("uint8 : 0 ~ %d\n", math.MaxUint8)
fmt.Printf("uint16 : 0 ~ %d\n", math.MaxUint16)
fmt.Printf("uint32 : 0 ~ %d\n", math.MaxUint32)
fmt.Printf("uint64 : 0 ~ %d\n", uint64(math.MaxUint64))
}
int : -9223372036854775808 ~ 9223372036854775807
int8 : -128 ~ 127
int16 : -32768 ~ 32767
int32 : -2147483648 ~ 2147483647
int64 : -9223372036854775808 ~ 9223372036854775807
uint : 0 ~ 18446744073709551615
uint8 : 0 ~ 255
uint16 : 0 ~ 65535
uint32 : 0 ~ 4294967295
uint64 : 0 ~ 18446744073709551615
Previous post
AWS CLI [CloudFront] - Cache 삭제 방법Next post
[GO] cgo - GO에서 C언어로 작성된 코드 사용하기