math

package
v1.21.11 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[NumType SignedNumberType](Num NumType) NumType

func Add added in v1.18.6

func Add[NumType NumberType](number1 NumType, number2 NumType) NumType

func AddSafe added in v1.21.4

func AddSafe[NumType NumberType](number1 NumType, number2 NumType) (NumType, bool)

func Max

func Max[NumType NumberType](number1 NumType, number2 NumType) NumType

func Min

func Min[NumType NumberType](number1 NumType, number2 NumType) NumType

func Mul added in v1.18.6

func Mul[NumType NumberType](number1 NumType, number2 NumType) NumType

func MulSafe added in v1.21.4

func MulSafe[NumType NumberType](number1 NumType, number2 NumType) (NumType, bool)

func PercentRateSafe added in v1.21.4

func PercentRateSafe[NumType NumberType, OutNumType NumberType](maxValue int64, rate NumType, numbers ...NumType) (OutNumType, bool)

安全的求比例

func Sub added in v1.18.6

func Sub[NumType NumberType](number1 NumType, number2 NumType) NumType

func SubSafe added in v1.21.4

func SubSafe[NumType NumberType](number1 NumType, number2 NumType) (NumType, bool)

Types

type FloatType

type FloatType interface {
	float32 | float64
}

type NumberType

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

type SignedNumberType

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

Jump to

Keyboard shortcuts

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