number

package
v0.70.13 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 7 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOverflow = errors.New("integer overflow")

Functions

func Clamp255Float64 added in v0.70.9

func Clamp255Float64(v float64) float64

Clamp255Float64 ensures values are within 0–255 range

func IntLength

func IntLength[I int | int8 | int16 | int32 | int64](num I) int

func IntSliceDedupe

func IntSliceDedupe(elems []int, sortElems bool) []int

func Itoi16 added in v0.68.13

func Itoi16(i int) (int16, error)

func Itoi32 added in v0.68.13

func Itoi32(i int) (int32, error)

func Itoi32s added in v0.68.16

func Itoi32s(ints []int) ([]int32, error)

func Itoi8 added in v0.68.13

func Itoi8(i int) (int8, error)

func Itou added in v0.68.16

func Itou(i int) (uint, error)

func Itou16 added in v0.69.3

func Itou16(i int) (uint16, error)

func Itou32 added in v0.68.13

func Itou32(i int) (uint32, error)

func Itous added in v0.68.16

func Itous(ints []int) ([]uint, error)

func MatrixColsMax added in v0.33.5

func MatrixColsMax(d [][]float64) []float64

func MatrixRowsMax added in v0.33.5

func MatrixRowsMax(d [][]float64) []float64

func Ntof64 added in v0.68.8

func Ntof64[N constraints.Integer | constraints.Float](val N) (float64, bool)

func SliceIntBuildBeginEnd added in v0.63.0

func SliceIntBuildBeginEnd(beg, end int) []int

SliceIntBuildBeginEnd returns of slice of integers from beginning to end, inclusive.

func SliceToFloat64 added in v0.41.1

func SliceToFloat64[T constraints.Integer | constraints.Float](src []T) []float64

SliceToFloat64 converts a slice of integers or floats to float64.

func U64toi64 added in v0.69.3

func U64toi64(u uint64) (int64, error)

func Utoi added in v0.70.9

func Utoi(u uint) (int, error)

Types

type Integer added in v0.69.3

type Integer interface {
	Signed | Unsigned
}

Integer is a constraint for all integer types (signed and unsigned).

type Integers added in v0.68.8

type Integers[C constraints.Integer] []C

func (Integers[C]) MinMax added in v0.70.5

func (ints Integers[C]) MinMax() (*C, *C)

func (Integers[C]) Sum added in v0.68.8

func (ints Integers[C]) Sum() C

func (Integers[C]) SumString added in v0.68.8

func (ints Integers[C]) SumString() string

type IntegersMatrix added in v0.68.8

type IntegersMatrix[C constraints.Integer] [][]C

func (IntegersMatrix[C]) ColumnSums added in v0.68.8

func (m IntegersMatrix[C]) ColumnSums(colIdx int, zeroOnEmpty bool) ([]C, error)

ColumnSums returns a slice where the element in each value is the sum of the column, e.g. [{sumColumn0},{sumColumn1},{sumColumn2}]

func (IntegersMatrix[C]) ColumnSumsSimple added in v0.70.5

func (m IntegersMatrix[C]) ColumnSumsSimple() []C

func (IntegersMatrix[C]) Sum added in v0.70.5

func (m IntegersMatrix[C]) Sum() C

type Signed added in v0.69.3

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned added in v0.69.3

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Jump to

Keyboard shortcuts

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