Documentation ¶
Index ¶
- func Average[T constraints.Float](input []T) T
- func Ceil[T constraints.Float](num T, n int) T
- func CeilDecimal[T constraints.Float](num T, n int) T
- func Collisions(size int, probability float64) float64
- func Factorial(n int) uint64
- func Floor[T constraints.Float](num T, n int) T
- func FloorDecimal[T constraints.Float](num T, n int) T
- func Root(num, root float64) float64
- func Round[T constraints.Float](num T, n int) T
- func RoundDecimal[T constraints.Float](num T, n int) T
- func Sum[T constraints.Integer | constraints.Float](nums []T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Average ¶
func Average[T constraints.Float](input []T) T
Average calculates the average of the elements in a slice.
This function uses rolling average calculation to sidestep issues related to overflow with large numbers in big slices.
func Ceil ¶
func Ceil[T constraints.Float](num T, n int) T
Ceil rounds a number up to n trailing zeroes.
func CeilDecimal ¶
func CeilDecimal[T constraints.Float](num T, n int) T
CeilDecimal rounds a number up to n decimal places.
func Collisions ¶
Collisions calculates the number of samples in a given set required for there to be a certain probability that there will be at least one collision. See: Birthday Problem.
func Floor ¶
func Floor[T constraints.Float](num T, n int) T
Floor rounds a number down to n trailing zeroes.
func FloorDecimal ¶
func FloorDecimal[T constraints.Float](num T, n int) T
FloorDecimal rounds a number down to n decimal places.
func Round ¶
func Round[T constraints.Float](num T, n int) T
Round rounds a number to the nearest n trailing zeroes.
func RoundDecimal ¶
func RoundDecimal[T constraints.Float](num T, n int) T
RoundDecimal rounds a number to the nearest n decimal places.
func Sum ¶
func Sum[T constraints.Integer | constraints.Float](nums []T) T
Sum calculates the sum of the elements in a slice.
Types ¶
This section is empty.