genericx

package
v1.3.14 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T SignedNumber](a T) T

Abs returns the absolute value of a signed number.

func Max

func Max[T Number](a, b T) T

Max returns the larger of two values.

func Min

func Min[T Number](a, b T) T

Min returns the smaller of two values.

Types

type Integer

type Integer interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Integer is a constraint that permits any integer type.

type Number

type Number interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
		~float32 | ~float64
}

Number is a constraint that permits any numeric type.

type SignedInteger

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

SignedInteger is a constraint that permits any signed integer type.

type SignedNumber

type SignedNumber interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~float32 | ~float64
}

SignedNumber is a constraint that permits any signed numeric type.

type UnsignedInteger

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

UnsignedInteger is a constraint that permits any unsigned integer type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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