Documentation
¶
Index ¶
- Variables
- func DecimalPlaces(value float64, prec int) float64
- func DecimalPlacesRound(value float64, rank int) float64
- func FormatFloat(num float64) string
- func FormatInt(i int64, base int) string
- func FormatUint(i uint64, base int) string
- func FormatUintBase32(f uint64) string
- func FormatUintBase58(f uint64) string
- func GenKey(key int64) int64
- func Max[T constraintsi.Ordered](data ...T) T
- func Min[T constraintsi.Ordered](data ...T) T
- func MinAndMax[T constraintsi.Ordered](data ...T) (T, T)
- func ParseBase32Uint(b []byte) (uint64, error)
- func ParseBase58Uint(b []byte) (uint64, error)
- func ParseInt(s string, base int, bitSize int) (i int64, err error)
- func ParseUint(s string, base int, bitSize int) (uint64, error)
- func SecondKey() int64
- func StandardDeviation[S ~[]T, T constraintsi.Number](data S, isSample bool) float64
- func ValidateKey(key, secretKey int64) float64
- func ValidateSecondKey(key int64) float64
- func Variance[S ~[]T, T constraintsi.Number](data S, isSample bool) float64
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidBase32 = errors.New("invalid base32")
ErrInvalidBase32 is returned by ParseBase32 when given an invalid []byte
var ErrInvalidBase58 = errors.New("invalid base58")
ErrInvalidBase58 is returned by ParseBase58 when given an invalid []byte
Functions ¶
func DecimalPlaces ¶
func FormatFloat ¶
func FormatInt ¶
FormatInt returns the string representation of i in the given base, for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z' for digit values >= 10.
func FormatUint ¶
FormatUint returns the string representation of i in the given base, for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z' for digit values >= 10.
func FormatUintBase32 ¶ added in v1.7.17
FormatUintBase32 uses the z-base-32 character set but encodes and decodes similar to base58, allowing it to create an even smaller result string. NOTE: There are many different base32 implementations so becareful when doing any interoperation.
func FormatUintBase58 ¶ added in v1.7.17
FormatUintBase58 returns a base58 string of the uint64
func Max ¶
func Max[T constraintsi.Ordered](data ...T) T
func Min ¶
func Min[T constraintsi.Ordered](data ...T) T
func MinAndMax ¶
func MinAndMax[T constraintsi.Ordered](data ...T) (T, T)
func ParseBase32Uint ¶ added in v1.7.17
ParseBase32Uint parses a base32 []byte into a uint64 NOTE: There are many different base32 implementations so becareful when doing any interoperation.
func ParseBase58Uint ¶ added in v1.7.17
ParseBase58Uint parses a base58 []byte into a uint64
func ParseInt ¶
ParseInt interprets a string s in the given base (0, 2 to 36) and bit size (0 to 64) and returns the corresponding value i.
The string may begin with a leading sign: "+" or "-".
If the base argument is 0, the true base is implied by the string's prefix following the sign (if present): 2 for "0b", 8 for "0" or "0o", 16 for "0x", and 10 otherwise. Also, for argument base 0 only, underscore characters are permitted as defined by the Go syntax for integer literals.
The bitSize argument specifies the integer type that the result must fit into. Bit sizes 0, 8, 16, 32, and 64 correspond to int, int8, int16, int32, and int64. If bitSize is below 0 or above 64, an error is returned.
The errors that ParseInt returns have concrete type *NumError and include err.Num = s. If s is empty or contains invalid base62Alphabet, err.Err = ErrSyntax and the returned value is 0; if the value corresponding to s cannot be represented by a signed integer of the given size, err.Err = ErrRange and the returned value is the maximum magnitude integer of the appropriate bitSize and sign.
func StandardDeviation ¶
func StandardDeviation[S ~[]T, T constraintsi.Number](data S, isSample bool) float64
func ValidateKey ¶
func ValidateSecondKey ¶
Types ¶
This section is empty.