github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/internal/limits/limits.go (about)

     1  package limits
     2  
     3  // fetch from math package
     4  const (
     5  	MaxFloat32             = 3.40282346638528859811704183484516925440e+38  // 2**127 * (2**24 - 1) / 2**23
     6  	SmallestNonzeroFloat32 = 1.401298464324817070923729583289916131280e-45 // 1 / 2**(127 - 1 + 23)
     7  
     8  	MaxFloat64             = 1.797693134862315708145274237317043567981e+308 // 2**1023 * (2**53 - 1) / 2**52
     9  	SmallestNonzeroFloat64 = 4.940656458412465441765687928682213723651e-324 // 1 / 2**(1023 - 1 + 52)
    10  )
    11  
    12  const (
    13  	MaxInt8   = 1<<7 - 1
    14  	MinInt8   = -1 << 7
    15  	MaxInt16  = 1<<15 - 1
    16  	MinInt16  = -1 << 15
    17  	MaxInt32  = 1<<31 - 1
    18  	MinInt32  = -1 << 31
    19  	MaxInt64  = 1<<63 - 1
    20  	MinInt64  = -1 << 63
    21  	MaxUint8  = 1<<8 - 1
    22  	MaxUint16 = 1<<16 - 1
    23  	MaxUint32 = 1<<32 - 1
    24  	MaxUint64 = 1<<64 - 1
    25  )
    26  
    27  const (
    28  	MaxUint = uint64(^uint(0))
    29  	MinUint = uint64(0)
    30  	MaxInt  = int64(int(MaxUint >> 1))
    31  	MinInt  = int64(-MaxInt - 1)
    32  )
    33  
    34  const (
    35  	IntSize  = 4 << (^uint(0) >> 63)
    36  	UintSize = IntSize
    37  	PtrSize  = 4 << (^uintptr(0) >> 63)
    38  )