math

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs added in v0.3.3

func Abs[T constraints.Integer | constraints.Float](x T) T

整型绝对值

func CeilEven added in v0.8.4

func CeilEven[T constraints.Integer](n T) T

接近n的最小偶数 eg: CeilEven(41) is 40, CeilEven(30) is also 30.

func Clip added in v0.3.3

func Clip[T constraints.Ordered](x, a, b T) T

裁剪

Types

type Rational added in v0.3.0

type Rational[N, D constraints.Integer | constraints.Float] struct {
	Num N
	Den D
}

func Fraction added in v0.3.0

func Fraction[N, D constraints.Integer | constraints.Float](num N, den D) *Rational[N, D]

Jump to

Keyboard shortcuts

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