mathext

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: GPL-3.0 Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs added in v1.10.0

func Abs[T Number](a T) T

Abs returns the absolute value of the input number.

func Max

func Max[T Number](a, b T) T

Max returns the maximum value between two input numbers.

func Mid

func Mid[T Number](a, b, c T) T

Mid returns the median value of three input numbers.

func Min

func Min[T Number](a, b T) T

Min returns the minimum value between two input numbers.

func WithinRange added in v1.13.0

func WithinRange[T Number](v, target, margin T) bool

WithinRange returns true if v is within [target-margin, target+margin].

Types

type Float

type Float interface {
	~float32 | ~float64
}

type Integer

type Integer interface {
	SignedInteger | UnsignedInteger
}

type Number added in v1.10.0

type Number interface {
	Integer | Float
}

type SignedInteger

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

type UnsignedInteger

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

Jump to

Keyboard shortcuts

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