math

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: GPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CeilToPowerOfTwo

func CeilToPowerOfTwo[T Integer](n T) T

CeilToPowerOfTwo 将整数型的数扩大到2^n,返回0代表执行错误

func FloorToPowerOfTwo

func FloorToPowerOfTwo[T Integer](n T) T

func IsComplex

func IsComplex(arg any) bool

func IsFloat

func IsFloat(arg any) bool

func IsInteger

func IsInteger(arg any) bool

func IsNumber

func IsNumber(arg any) bool

func IsSigned

func IsSigned(arg any) bool

func IsUnSigned

func IsUnSigned(arg any) bool

func Max

func Max[T Number](a, b T, args ...T) (m T)

Max 返回任意整数类型的最大值

func Min

func Min[T Number](a, b T, args ...T) (m T)

Min 返回任意整数类型的最小值

func NumberToFloat64

func NumberToFloat64(arg any) float64

Types

type Integer

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

type Number

type Number interface {
	Integer | float32 | float64
}

Jump to

Keyboard shortcuts

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