Simple to use fixed-point library.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qformatpy-1.0.2.tar.gz.
File metadata
- Download URL: qformatpy-1.0.2.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.25.4 CPython/3.13.5 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c443eb26365cd99d8d13a0558e7bec5c4db0d5b0cabf2690fe238f8a0f9c9f65
|
|
| MD5 |
fd577c38e6d9dfbb8181c3ff4c426f2b
|
|
| BLAKE2b-256 |
421a323e599cd997e7ee6abdabc0a628b314803f2d24f72133564d90f3661ea7
|
File details
Details for the file qformatpy-1.0.2-py3-none-any.whl.
File metadata
- Download URL: qformatpy-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.25.4 CPython/3.13.5 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3369d6a1855f46df1b506ca7e382907877b8ec31f252e704ffb6b06eb3a2ca85
|
|
| MD5 |
cc16535e37dd536c8ab0228159d65a09
|
|
| BLAKE2b-256 |
23f4255e3b5bb35c6f79dda95aaa99bfee0b91a16ca19e889e98b541911421fe
|