BinaryFixedPoint
A fixed-point number whose scale is a power of 2. The stored raw bigint
represents the mathematical value raw / 2 ** fractionalBits.
Binary fixed-point is the fastest fractional representation to compute with — rescaling is a bit shift — so it is the preferred choice for audio samples, graphics, probabilities, and any other quantity where performance matters and the scale does not need to align with decimal digits.
Example
A 16-bit signed Q1.15 audio sample:
See
Type Parameters
| Type Parameter | Description |
|---|---|
TSignedness extends Signedness | Whether the value can be negative. |
TTotalBits extends number | The total number of bits used to store the raw value. |
TFractionalBits extends number | The number of bits to the right of the binary point. |