mathutils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsDiff

func AbsDiff[T basic_utils.Numeric](one T, two T) T

AbsDiff returns absolute diff result of a numeric type

func AbsVal

func AbsVal[T basic_utils.Numeric](val T) T

AbsVal returns absolute value of a numeric type

func Avg

func Avg[T basic_utils.Numeric](array []T) T

Avg returns average value from the array

func AvgFloat

func AvgFloat[T basic_utils.Numeric](array []T) float64

AvgFloat returns average value from the array as float64

func ClosestMatch

func ClosestMatch[T basic_utils.Numeric](toMatch T, slice []T) (int, T)

ClosestMatch finds the closest match in a slice. This implementation doesn't use Round. Returns index of a found element and the element. If no element was found then -1 as index will be returned.

func Max

func Max[T basic_utils.Numeric](array []T) T

Max returns mx numeric value found in array

func MaxValue

func MaxValue[T basic_utils.Numeric]() T

func Med

func Med[T basic_utils.Numeric](array []T) T

func Min

func Min[T basic_utils.Numeric](array []T) T

Min returns mn numeric value found in array

func MinMax

func MinMax[T basic_utils.Numeric](array []T) (T, T)

func MinMaxFromMap

func MinMaxFromMap[K comparable, T basic_utils.Numeric](m map[K]T) (T, T)

func MinMaxInt

func MinMaxInt(array []int) (int, int)

MinMaxInt returns mn and mx value in array correspondingly

func RoundWithPrecision

func RoundWithPrecision[T basic_utils.Numeric](value T, precision int) T

func Sum

func Sum[T basic_utils.Numeric](array []T) T

func ValOrMin

func ValOrMin(val int, mn int) int

ValOrMin returns value or mn if value is less than mn

Types

This section is empty.

Jump to

Keyboard shortcuts

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