Documentation
¶
Index ¶
- Constants
- Variables
- func Abs[N Number](x N) N
- func Acos[N Number](x N) N
- func Acosh[N Number](x N) N
- func Add[N Number](x, y N) N
- func ApproxEqual[N Number](x, y N, tolerance float64) bool
- func Asin[N Number](x N) N
- func Asinh[N Number](x N) N
- func Atan[N Number](x N) N
- func Atan2[N Number](y, x N) N
- func Atanh[N Number](x N) N
- func Avg[N Number](x ...N) N
- func Blend[N Number](x, y N, p float64) N
- func Cbrt[N Number](x N) N
- func Ceil[N Number](x N) N
- func Clamp[N Number](x, min, max N) N
- func Copysign[N Number](f, sign N) N
- func Cos[N Number](x N) N
- func Cosh[N Number](x N) N
- func Delta[N Number](x, y N) N
- func Denormalize[N Number](norm, min, max N) N
- func Dim[N Number](x, y N) N
- func Erf[N Number](x N) N
- func Erfc[N Number](x N) N
- func Erfcinv[N Number](x N) N
- func Erfinv[N Number](x N) N
- func Exp[N Number](x N) N
- func Exp2[N Number](x N) N
- func Expm1[N Number](x N) N
- func FMA[N Number](x, y, z N) N
- func Floor[N Number](x N) N
- func FormatNumber[N Number](number N, decimals int) string
- func Gamma[N Number](x N) N
- func Hypot[N Number](p, q N) N
- func J0[N Number](x N) N
- func J1[N Number](x N) N
- func Lerp[N Number](a, b N, t float64) N
- func Log[N Number](x N) N
- func Log1p[N Number](x N) N
- func Log2[N Number](x N) N
- func Log10[N Number](x N) N
- func Logb[N Number](x N) N
- func Max[N Number](x, y N) N
- func MaxLenStr(strs ...string) int
- func Min[N Number](x, y N) N
- func Mod[N Number](x, y N) N
- func NaN[N Number]() N
- func Nextafter[N Number](x, y N) N
- func Normalize[N Number](val, min, max N) N
- func Pow[N Number](x, y N) N
- func Remainder[N Number](x, y N) N
- func Round[N Number](x N) N
- func RoundToEven[N Number](x N) N
- func Sin[N Number](x N) N
- func Sinh[N Number](x N) N
- func Sqrt[N Number](x N) N
- func Sub[N Number](x, y N) N
- func Tan[N Number](x N) N
- func Tanh[N Number](x N) N
- func Trunc[N Number](x N) N
- func Wrap[N Number](val, min, max N) N
- func Y0[N Number](x N) N
- func Y1[N Number](x N) N
- type Float
- type Matrix
- type Number
Constants ¶
const ( E = math.E Pi = math.Pi Phi = math.Phi Sqrt2 = math.Sqrt2 SqrtE = math.SqrtE SqrtPi = math.SqrtPi SqrtPhi = math.SqrtPhi Ln2 = math.Ln2 Log2E = math.Log2E Ln10 = math.Ln10 Log10E = math.Log10E MaxFloat32 = math.MaxFloat32 SmallestNonzeroFloat32 = math.SmallestNonzeroFloat32 MaxFloat64 = math.MaxFloat64 SmallestNonzeroFloat64 = math.SmallestNonzeroFloat64 MaxInt = math.MaxInt MinInt = math.MinInt MaxInt8 = math.MaxInt8 MinInt8 = math.MinInt8 MaxInt16 = math.MaxInt16 MinInt16 = math.MinInt16 MaxInt32 = math.MaxInt32 MinInt32 = math.MinInt32 MaxInt64 = math.MaxInt64 MinInt64 = math.MinInt64 MaxUint = math.MaxUint MaxUint8 = math.MaxUint8 MaxUint16 = math.MaxUint16 MaxUint32 = math.MaxUint32 MaxUint64 = math.MaxUint64 )
Core constants: re-exported from the standard math package.
const (
Tau = 2 * Pi
)
Tau is 2 * Pi.
Variables ¶
var ( InfMin = math.Inf(-1) InfMax = math.Inf(1) )
User-defined variables.
var Float32bits = math.Float32bits
Direct alias.
var Float32frombits = math.Float32frombits
Direct alias.
var Float64bits = math.Float64bits
Direct alias.
var Float64frombits = math.Float64frombits
Direct alias.
var Frexp = math.Frexp
Direct alias.
var Ilogb = math.Ilogb
Direct alias.
var Inf = math.Inf
Direct alias.
var IsInf = math.IsInf
Direct alias.
var IsNaN = math.IsNaN
Direct alias.
var Jn = math.Jn
Direct alias.
var Ldexp = math.Ldexp
Direct alias.
var Lgamma = math.Lgamma
Direct alias.
var Modf = math.Modf
Direct alias.
var Nextafter32 = math.Nextafter32
Direct alias.
var Pow10 = math.Pow10
Direct alias.
var Signbit = math.Signbit
Direct alias.
var Sincos = math.Sincos
Direct alias.
var Yn = math.Yn
Direct alias.
Functions ¶
func ApproxEqual ¶
ApproxEqual checks if two numbers are approximately equal within a given tolerance. The tolerance is the maximum allowed difference between the numbers. For example, if tolerance is 0.001, the numbers are considered equal if their difference is less than 0.001.
func Clamp ¶
func Clamp[N Number](x, min, max N) N
Clamp restricts x to be within the range [min, max].
func Denormalize ¶
func Denormalize[N Number](norm, min, max N) N
Denormalize converts a normalized value in [0,1] to the target range [min, max]. The normalized value is clamped between 0 and 1.
func FormatNumber ¶
FormatNumber formats a number with appropriate suffixes for large values.
func Lerp ¶
Lerp performs linear interpolation between a and b with weight t. The parameter t is typically in range [0,1].
func Normalize ¶
func Normalize[N Number](val, min, max N) N
Normalize converts a value from a given range [min, max] to a normalized value in [0,1]. If min equals max, it returns 0.
func RoundToEven ¶
func RoundToEven[N Number](x N) N