maths

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsInt added in v0.5.0

func AsInt[V Number](v V) int

func AsInt64 added in v0.5.0

func AsInt64[V Number](v V) int64

func AsUint added in v0.5.0

func AsUint[V Number](v V) uint

func AsUint64 added in v0.5.0

func AsUint64[V Number](v V) uint64

func Atoi added in v0.5.1

func Atoi(v interface{}) (number int)

func Ceil

func Ceil[V Number](value, max V) V

func Clamp

func Clamp[V Number](value, min, max V) V

func Floor

func Floor[V Number](value, min V) V

func ReverseSortedNumbers

func ReverseSortedNumbers[K Number, V interface{}](data map[K]V) (keys []K)

func Round added in v0.4.0

func Round[V Decimal](x V) (rounded int)

func RoundDown added in v0.5.0

func RoundDown[V Decimal](value V) (rounded int)

func RoundUp added in v0.5.0

func RoundUp[V Decimal](value V) (rounded int)

func SortedNumbers

func SortedNumbers[K Number, V interface{}](data map[K]V) (keys []K)

func ToFloat64 added in v0.5.0

func ToFloat64(v interface{}, d float64) float64

func ToInt added in v0.5.0

func ToInt(v interface{}, d int) int

func ToInt64 added in v0.5.0

func ToInt64(v interface{}, d int64) int64

func ToUint added in v0.5.0

func ToUint(v interface{}, d uint) uint

func ToUint64 added in v0.5.0

func ToUint64(v interface{}, d uint64) uint64

Types

type Complex added in v0.5.0

type Complex interface {
	~complex64 | ~complex128
}

type Decimal added in v0.4.0

type Decimal interface {
	~float32 | ~float64
}

type Integer added in v0.5.0

type Integer interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Integers added in v0.5.0

type Integers interface {
	Integer | UnsignedInteger
}

type Number

type Number interface {
	UnsignedInteger | Integer | Decimal
}

type UnsignedInteger added in v0.4.0

type UnsignedInteger interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Jump to

Keyboard shortcuts

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