fpxt
pyfxp.fxpt
Convert a numeric value to fixed-point representation using Q-format notation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
(int, float or array - like)
|
The input value(s) to convert. |
required |
qi
|
int
|
Number of integer bits (including sign bit if signed=True). |
required |
qf
|
int
|
Number of fractional bits. |
required |
signed
|
bool
|
Whether the fixed-point format is signed (default is True). |
True
|
rnd
|
int
|
Rounding method to apply (default is TRUNC (0)). Supported methods:
|
TRUNC
|
ovf
|
int
|
Overflow handling method (default is WRAP (0)). Supported methods:
|
WRAP
|
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) (including sign bit if signed=True) - n fractional bits (qf)
Examples: