maths

package
v0.1.109 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T types.SignedNumber](val T) T

Abs 计算绝对值

func Average

func Average[T types.SignedNumber | types.UnsignedNumber](items ...T) T

Average 计算所有元素的平均值

func Ceil

func Ceil[T types.SignedNumber | types.UnsignedNumber](val T) T

Ceil 向上取整

func Clamp

func Clamp[T types.Hashable](value T, minVal T, maxVal T) T

Clamp 返回限制在minVal和maxVal范围内的value

func Floor

func Floor[T types.SignedNumber | types.UnsignedNumber](val T) T

Floor 向下取整

func MaxWithIndex

func MaxWithIndex[T types.Hashable](items ...T) (T, int)

MaxWithIndex 查找所有元素中的最大值

func MinWithIndex

func MinWithIndex[T types.Hashable](items ...T) (T, int)

MinWithIndex 查找所有元素中的最小值

func Round

func Round[T types.SignedNumber | types.UnsignedNumber](val T) T

Round 四舍五入取整

func Sum

func Sum[T types.SignedNumber | types.UnsignedNumber](items ...T) T

Sum 计算所有元素总和

Types

This section is empty.

Jump to

Keyboard shortcuts

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