Documentation ¶
Index ¶
- Constants
- Variables
- func Atof32(s string) (float32, error)
- func Atof64(s string) (float64, error)
- func Atoi(s string) (int, error)
- func Atoi16(s string) (int16, error)
- func Atoi32(s string) (int32, error)
- func Atoi64(s string) (int64, error)
- func Atoi8(s string) (int8, error)
- func Atou(s string) (uint, error)
- func Atou16(s string) (uint16, error)
- func Atou32(s string) (uint32, error)
- func Atou64(s string) (uint64, error)
- func Atou8(s string) (uint8, error)
- func Bool(b bool) int
- func F32toa(f float32) string
- func F64toa(f float64) string
- func FormatFloat32(f float32, fmt byte, prec int) string
- func FormatFloat64(f float64, fmt byte, prec int) string
- func FormatInt(i int, base int) string
- func FormatInt16(i int16, base int) string
- func FormatInt32(i int32, base int) string
- func FormatInt64(i int64, base int) string
- func FormatInt8(i int8, base int) string
- func FormatUint(i uint, base int) string
- func FormatUint16(i uint16, base int) string
- func FormatUint32(i uint32, base int) string
- func FormatUint64(i uint64, base int) string
- func FormatUint8(i uint8, base int) string
- func I16toa(i int16) string
- func I32toa(i int32) string
- func I64toa(i int64) string
- func I8toa(i int8) string
- func Itoa(i int) string
- func ParseFloat32(s string) (float32, error)
- func ParseFloat64(s string) (float64, error)
- func ParseInt(s string, base int) (int, error)
- func ParseInt16(s string, base int) (int16, error)
- func ParseInt32(s string, base int) (int32, error)
- func ParseInt64(s string, base int) (int64, error)
- func ParseInt8(s string, base int) (int8, error)
- func ParseUint(s string, base int) (uint, error)
- func ParseUint16(s string, base int) (uint16, error)
- func ParseUint32(s string, base int) (uint32, error)
- func ParseUint64(s string, base int) (uint64, error)
- func ParseUint8(s string, base int) (uint8, error)
- func RenderByte(b float64) string
- func U16toa(i uint16) string
- func U32toa(i uint32) string
- func U64toa(i uint64) string
- func U8toa(i uint8) string
- func Utoa(i uint) string
- type Accuracy
Constants ¶
View Source
const ( MinInt8 = int8(-128) // -1 << 7 MinInt16 = int16(-32768) // -1 << 15 MinInt32 = int32(-2147483648) // -1 << 31 MinInt64 = int64(-9223372036854775808) // -1 << 63 MinUint8 = uint8(0) // 0 MinUint16 = uint16(0) // 0 MinUint32 = uint32(0) // 0 MinUint64 = uint64(0) // 0 MaxInt8 = int8(127) // 1<<7 - 1 MaxInt16 = int16(32767) // 1<<15 - 1 MaxInt32 = int32(2147483647) // 1<<31 - 1 MaxInt64 = int64(9223372036854775807) // 1<<63 - 1 MaxUint8 = uint8(255) // 1<<8 - 1 MaxUint16 = uint16(65535) // 1<<16 - 1 MaxUint32 = uint32(4294967295) // 1<<32 - 1 MaxUint64 = uint64(18446744073709551615) // 1<<64 - 1 MaxFloat32 = float32(math.MaxFloat32) // 2**127 * (2**24 - 1) / 2**23 SmallestNonzeroFloat32 = float32(math.SmallestNonzeroFloat32) // 1 / 2**(127 - 1 + 23) MaxFloat64 = float64(math.MaxFloat64) // 2**1023 * (2**53 - 1) / 2**52 SmallestNonzeroFloat64 = float64(math.SmallestNonzeroFloat64) // 1 / 2**(1023 - 1 + 52) )
Variables ¶
View Source
var DefaultAccuracy = NewAccuracy(1e-3)
DefaultAccuracy means default accuracy, use 1e-3.
Functions ¶
func FormatInt16 ¶
func FormatInt32 ¶
func FormatInt64 ¶
func FormatInt8 ¶
func FormatUint ¶
func FormatUint16 ¶
func FormatUint32 ¶
func FormatUint64 ¶
func FormatUint8 ¶
func ParseFloat32 ¶
func ParseFloat64 ¶
func RenderByte ¶
RenderByte renders a byte size to string (using %.2f), support `B` `KB` `MB` `GB` `TB`.
Types ¶
type Accuracy ¶
type Accuracy func() float64
Accuracy includes some accuracy functions using the given accuracy.
func NewAccuracy ¶
NewAccuracy creates an Accuracy, using eps as accuracy.
func (Accuracy) GreaterOrEqual ¶
GreaterOrEqual checks gte between two float64.
func (Accuracy) SmallerOrEqual ¶
SmallerOrEqual checks lte between two float64.
Click to show internal directories.
Click to hide internal directories.