math

package
v1.2.68 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp added in v1.2.38

func Clamp[T constraints.Ordered](v, lo, hi T) T

Clamp returns the value between boundary [lo,hi], as v < lo ? v : hi > v : hi : v. Reference to lo if v is less than lo, reference to hi if hi is less than v, otherwise reference to v. If v compares equivalent to either bound, returns a reference to v, not the bound.

func Dim

func Dim[T constraints_.Number](x, y T) T

Dim returns the maximum of x-y or 0.

func Max

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

Max returns the largest of s.

func Min

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

Min returns the smallest of s.

func RingRem added in v1.2.68

func RingRem[T constraints.Integer](x, y T) T

RingRem returns the remainder of x looped by +ny until in y > 0 ? [0, y) : (y, 0]. RingRem panics for y == 0 (division by zero). y > 0, then ∈ [0, y) y < 0, then ∈ (y, 0]

Types

This section is empty.

Jump to

Keyboard shortcuts

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