Documentation
¶
Overview ¶
Package fx adds support for working with 16.16 fixed-point numbers.
Index ¶
- type ExprVarMap
- type T
- func Abs(f T) T
- func Acos(a T) T
- func Add(lhs, rhs T) T
- func Addf(lhs T, rhs float32) T
- func Addi(lhs T, rhs int) T
- func Asin(a T) T
- func Ceil(f T) T
- func Clamp(f, min, max T) T
- func Cos(a T) T
- func Div(lhs, rhs T) T
- func Divf(lhs T, rhs float32) T
- func Divi(lhs T, rhs int) T
- func Expr(expr string) T
- func ExprVars(expr string, values ExprVarMap) T
- func F[FT ~float32 | ~float64](f FT) T
- func Floor(f T) T
- func I(i int) T
- func InvSqrt(x T) T
- func Max(a, b T) T
- func MaximumValue() T
- func Min(a, b T) T
- func MinimumValue() T
- func Mod(lhs, rhs T) T
- func Mul(lhs, rhs T) T
- func Mulf(lhs T, rhs float32) T
- func Muli(lhs T, rhs int) T
- func NegOne() T
- func Negate(f T) T
- func One() T
- func Pi() T
- func Pi2() T
- func Round(f T) T
- func Sin(a T) T
- func Sqrt(x T) T
- func Square(f T) T
- func Sub(lhs, rhs T) T
- func Subf(lhs T, rhs float32) T
- func Subi(lhs T, rhs int) T
- func Tan(a T) T
- func Tau() T
- func Zero() T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExprVarMap ¶
ExprVarMap is used to pass named values to a fixed-point expression.
type T ¶
type T struct {
// contains filtered or unexported fields
}
T represents a 16.16 fixed-point number.
func Expr ¶
Expr parses a Go math expression and returns its fixed-point value. It will panic when given an invalid expression. Note: Only constant numeric values are valid in the given expression. To use named values, call ExprVars instead. Note: This method is much slower than calling standard functions and should only be used to cache calculations.
func ExprVars ¶
func ExprVars(expr string, values ExprVarMap) T
ExprVars parses a Go math expression and returns its fixed-point value. Unlike Expr, ExprVars allows a list of variables to be passed from the outside context.
func MaximumValue ¶
func MaximumValue() T
MaximumValue returns the highest value representable by T (approximately 32767.00)
func MinimumValue ¶
func MinimumValue() T
MinimumValue returns the lowest value representable by T (approximately -32768.00)