number

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package number contains generic functions primarily for use with numbers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Max

func Max[N constraints.Ordered](nums ...N) (n N)

Max returns the maximum in a list of numbers

func Min

func Min[N constraints.Ordered](nums ...N) (n N)

Min returns the minimum in a list of numbers

func Round

func Round[N Number](f float64, p N) float64

Round rounds a float to the specified digits of precision

func Sum

func Sum[N constraints.Ordered](nums ...N) (n N)

Sum returns the sum of a list of numbers

Types

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

Number is any number type

Jump to

Keyboard shortcuts

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