nulib.math.fixed

Nulib Fixed Point Math

Members

Aliases

fixed16
alias fixed16 = Fixed!short

Q8.8 fixed-point number (16-bit)

fixed26_6
alias fixed26_6 = Fixed!(int, 6)

Q26.6 fixed-point number (32-bit)

fixed2_14
alias fixed2_14 = Fixed!(short, 14)

Q2.14 fixed-point number (16-bit)

fixed2_6
alias fixed2_6 = Fixed!(byte, 6)

Q2.6 fixed-point number (8-bit)

fixed32
alias fixed32 = Fixed!int

Q16.16 fixed-point number (32-bit)

fixed64
alias fixed64 = Fixed!long

Q32.32 fixed-point number (64-bit)

Enums

isFixed
eponymoustemplate isFixed(T)

Gets whether the provided value is a instance of Fixed

Functions

ceil
T ceil(T x)

Computes the nearest integer value greater than the given value.

floor
T floor(T x)

Computes the nearest integer value lower than the given value.

fract
T fract(T value)

Gets the fractional part of the value.

trunc
T trunc(T x)

Computes the nearest integer value lower in magnitude than the given value.

Structs

Fixed
struct Fixed(T, size_t FRACT_BITS = (8 * (T.sizeof / 2)))

Fixed-point math type, fractional bits can be specified, but by default is split evenly; eg Fixed!int will be Q16.16

Meta

Authors

Luna Nielsen