math

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

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

整型绝对值

func CeilEven

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

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

func Clip

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

裁剪

func Inscribed

func Inscribed[T constraints.Integer](outW, outH, w, h T) (T, T)

内接

func Position

func Position[T constraints.Integer](outW, outH, w, h, xp, yp T) (T, T)

Types

type Rational

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

func Fraction

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