math

package
v1.1.58 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualsAny

func EqualsAny[T comparable](lhs T, others ...T) bool

EqualsAny returns true if lhs is equal to any item in others

func FormatFloat added in v1.1.48

func FormatFloat[T constraints.Float](value T, args ...any) string

FormatFloat formats the floating-point value as a string. the function accepts up to two optional arguments: a byte that will be used to describe the format of the value which defaults to 'f' if no value is provided and an integer value describing the precision of the floating-point value which defaults to -1. The arguments must be provided in order, if provided.

func FormatInt added in v1.1.48

func FormatInt[T constraints.Signed](value T, args ...any) string

FormatInt formats the integer value as a string. The function accepts an optional argument of an integer value that will be used to inform the base of the integer. This argument, if not provided or invalid, will default to 10, meaning that the value will be formatted as a base-10 integer

func FormatUint added in v1.1.48

func FormatUint[T constraints.Unsigned](value T, args ...any) string

FormatUint formats the unsigned integer value as a string. The function accepts an optional argument of an integer value that will be used to inform the base of the usigned integer. This argument, if not provided or invalid, will default to 10, meaning that the value will be formatted as a base-10 integer

func Max

func Max[T constraints.Ordered](items ...T) T

Max calculates the maximum of a list of ordered items, returning it. Note that, if this function is called with no arguments, then it will panic as it depends on at least one item being in the slice

func Min

func Min[T constraints.Ordered](items ...T) T

Min calculates the minimum of a list of ordered items, returning it. Note that, if this function is called with no arguments, then it will panic as it depends on at least one item being in the slice

func VerifyInteger

func VerifyInteger(decimal float64) (int64, error)

VerifyInteger converts a floating-point number to an integer and verifies that no information will be lost in doing so. If this is not the case then an error will be returned

Types

This section is empty.

Jump to

Keyboard shortcuts

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