Documentation ¶
Overview ¶
This math package contains number utlities that are not included in the Go math library, but that are still very useful. Feel free to add to it.
Index ¶
- func AbsInt(a int) int
- func CubeInt(a int) int
- func DiffInts(values ...int) (diffs []int)
- func MaxInt(values ...int) (index int, value int)
- func MinInt(values ...int) (index int, value int)
- func PowerInt(base int, power int) int
- func RoundFloat(f float64, digits int) float64
- func RoundInt(f float64) int
- func SqSqInt(a int) int
- func SquareInt(a int) int
- func SumInts(values ...int) (sums []int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiffInts ¶
DiffInts returns the difference between each item, and the next item in the list. The last diff is between the last item and the first item. Returns the differences as a slice. If there is only one item, it will return just the one item, and not diff it with itself.
func MaxInt ¶
MaxInts returns the maiximum value from a slice of ints, and the index of that value. The index will be -1 if no items are given.
func MinInt ¶
MinInt returns the minimum value from a slice of ints, and the zero-based index of that value. The index will be -1 if there are no values given.
func PowerInt ¶
PowerInt returns the given base integer raised to the given power. If your base integer is zero, you will get a zero back regardless of the power.
func RoundFloat ¶
Types ¶
This section is empty.