API Reference
qformatpy package.
| MODULE | DESCRIPTION |
|---|---|
constants |
Rounding method constants for use with Numba-optimized functions. |
| FUNCTION | DESCRIPTION |
|---|---|
qformat |
Convert a numeric value to fixed-point representation using Q-format notation. |
qformat
qformat(
x: float | ndarray,
qi: int,
qf: int,
signed: bool = True,
rnd_method=TRUNC,
ovf_method=WRAP,
) -> float | ndarray
Convert a numeric value to fixed-point representation using Q-format notation.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The input value(s) to convert. |
qi
|
Number of integer bits (excluding sign bit if signed=True).
TYPE:
|
qf
|
Number of fractional bits.
TYPE:
|
signed
|
Whether the fixed-point format is signed (default is True).
TYPE:
|
rnd_method
|
Rounding method to apply (default is TRUNC (0)). Supported methods:
TYPE:
|
ovf_method
|
Overflow handling method (default is WRAP (0)). Supported methods:
TYPE:
|
Returns:
float or ndarray Fixed-point representation of the input, as integer(s).
Notes:
Uses ARM-style Q-format notation where a Qm.n format has:
- m integer bits (qi)
- n fractional bits (qf)
- Optional sign bit if signed is True