Easy-to-use fixed-point library
qformatpy is a lightweight Python library for converting numbers to fixed-point format using the ARM-style Qm.n notation. It is designed to be simple, readable, and easy to integrate into simulation, modeling, or hardware verification pipelines.
The library provides a single function, qformat, that lets you control integer and fractional precision, signedness, rounding behavior, and overflow handling — all without the complexity of a full fixed-point arithmetic suite.
Whether you're developing embedded systems, DSP algorithms, or just need fast fixed-point conversion, qformatpy keeps things straightforward.
To get started, check the example of a fixed-point integrator implemented using the library.
Features
-
Support for Numba Optimized with optional Numba acceleration for fast, JIT-compiled conversions.
-
Native NumPy Array Support Seamlessly handles
numpy.ndarrayinputs for efficient batch processing. -
Flexible Rounding Modes Choose from 9 rounding modes, including truncation, ceiling, rounding to nearest (with tie-breaking), and more.
-
Customizable Overflow Handling Select between wraparound, saturation, or error-on-overflow behavior.
-
Signed and Unsigned Formats Easily switch between signed and unsigned representations using the
signedparameter. -
Consistent Q-Format Notation Follows ARM-style Qm.n notation for compatibility with DSP and embedded tools.
-
Well-Suited for Embedded and DSP Simulation Ideal for preparing and validating fixed-point behavior before deploying to hardware.
Installation
Installing it is pretty easy:
pip install qformatpy
Metadata
Release files for qformatpy 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qformatpy-1.0.2.tar.gz | 41.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qformatpy-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.8 kB
Release files / qformatpy-1.0.2.tar.gz
| Download URL | qformatpy-1.0.2.tar.gz |
|---|---|
| Size | 41.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c443eb26365cd99d8d13a0558e7bec5c4db0d5b0cabf2690fe238f8a0f9c9f65
|
|
BLAKE2b-256 checksum How to use checksums |
421a323e599cd997e7ee6abdabc0a628b314803f2d24f72133564d90f3661ea7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.25.4 CPython/3.13.5 Linux/6.11.0-1018-azure
|
Release files / qformatpy-1.0.2-py3-none-any.whl
| Download URL | qformatpy-1.0.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3369d6a1855f46df1b506ca7e382907877b8ec31f252e704ffb6b06eb3a2ca85
|
|
BLAKE2b-256 checksum How to use checksums |
23f4255e3b5bb35c6f79dda95aaa99bfee0b91a16ca19e889e98b541911421fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.25.4 CPython/3.13.5 Linux/6.11.0-1018-azure
|