math

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinInt48 int64 = -(1 << 47)
	MaxInt48 int64 = +(1 << 47) - 1
)

Variables

This section is empty.

Functions

func DecimalPlaces

func DecimalPlaces(value float64, prec int) float64

func DecimalPlacesRound

func DecimalPlacesRound(value float64, rank int) float64

四舍五入

func FormatFloat

func FormatFloat(num float64) string

func FormatInt

func FormatInt(i int64, base int) string

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 added in v0.0.18

func FormatUint(i uint64, base int) string

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 GenKey

func GenKey(key int64) int64

func PackInt

func PackInt(v int) uint64

func ParseInt

func ParseInt(s string, base int, bitSize int) (i int64, err error)

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 digits, 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 ParseUint added in v0.0.18

func ParseUint(s string, base int, bitSize int) (uint64, error)

func SecondKey

func SecondKey() int64

func StandardDeviation added in v0.3.1

func StandardDeviation[S ~[]T, T constraintsi.Number](data S, isSample bool) float64

func UnpackInt

func UnpackInt(v uint64) int

func ValidateKey

func ValidateKey(key, secretKey int64) float64

func ValidateSecondKey

func ValidateSecondKey(key int64) float64

func Variance added in v0.3.1

func Variance[S ~[]T, T constraintsi.Number](data S, isSample bool) float64

Types

This section is empty.

Directories

Path Synopsis
v2

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL