[](https://badge.fury.io/py/qformatpy)
[](https://github.com/ericsmacedo/qformatpy/actions/workflows/main.yml)
[](https://qformatpy.readthedocs.io/en/stable/)
[](https://coveralls.io/github/ericsmacedo/qformatpy?branch=main)
[](https://pypi.python.org/pypi/qformatpy)
[](https://semver.org/)
[](https://github.com/ericsmacedo/qformatpy/graphs/contributors/)
[](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
[](https://github.com/ericsmacedo/qformatpy/issues)
[](https://github.com/ericsmacedo/qformatpy/pulls)
[](https://github.com/ericsmacedo/qformatpy/pulls?q=is%3Apr+is%3Aclosed)
# 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](docs/example_int/example_int.md) implemented
using the library.
- [Documentation](https://qformatpy.readthedocs.io/en/latest/)
- [PyPI](https://pypi.org/project/qformatpy/)
- [Sources](https://github.com/ericsmacedo/qformatpy)
- [Issues](https://github.com/ericsmacedo/qformatpy/issues)
## Features
- **Support for Numba**
Optimized with optional [Numba](https://numba.pydata.org/) acceleration for fast, JIT-compiled conversions.
- **Native NumPy Array Support**
Seamlessly handles `numpy.ndarray` inputs 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 `signed` parameter.
- **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:
```bash
pip install qformatpy
```
Raw data
{
"_id": null,
"home_page": null,
"name": "qformatpy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10.0",
"maintainer_email": null,
"keywords": "DSP, Fixed-point, Signal-Processing, Qformat",
"author": null,
"author_email": "Eric Macedo <ericsmacedo@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/42/1a/323e599cd997e7ee6abdabc0a628b314803f2d24f72133564d90f3661ea7/qformatpy-1.0.2.tar.gz",
"platform": null,
"description": "\n[](https://badge.fury.io/py/qformatpy)\n[](https://github.com/ericsmacedo/qformatpy/actions/workflows/main.yml)\n[](https://qformatpy.readthedocs.io/en/stable/)\n[](https://coveralls.io/github/ericsmacedo/qformatpy?branch=main)\n[](https://pypi.python.org/pypi/qformatpy)\n[](https://semver.org/)\n\n[](https://github.com/ericsmacedo/qformatpy/graphs/contributors/)\n[](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)\n[](https://github.com/ericsmacedo/qformatpy/issues)\n[](https://github.com/ericsmacedo/qformatpy/pulls)\n[](https://github.com/ericsmacedo/qformatpy/pulls?q=is%3Apr+is%3Aclosed)\n\n# Easy-to-use fixed-point library\n\n**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.\n\nThe library provides a single function, `qformat`, that lets you control integer and fractional precision, signedness, rounding behavior, and overflow handling \u2014 all without the complexity of a full fixed-point arithmetic suite.\n\nWhether you're developing embedded systems, DSP algorithms, or just need fast fixed-point conversion, **qformatpy** keeps things straightforward.\n\nTo get started, check the example of a [fixed-point integrator](docs/example_int/example_int.md) implemented\nusing the library.\n\n- [Documentation](https://qformatpy.readthedocs.io/en/latest/)\n- [PyPI](https://pypi.org/project/qformatpy/)\n- [Sources](https://github.com/ericsmacedo/qformatpy)\n- [Issues](https://github.com/ericsmacedo/qformatpy/issues)\n\n## Features\n\n- **Support for Numba**\n Optimized with optional [Numba](https://numba.pydata.org/) acceleration for fast, JIT-compiled conversions.\n\n- **Native NumPy Array Support**\n Seamlessly handles `numpy.ndarray` inputs for efficient batch processing.\n\n- **Flexible Rounding Modes**\n Choose from 9 rounding modes, including truncation, ceiling, rounding to nearest (with tie-breaking), and more.\n\n- **Customizable Overflow Handling**\n Select between wraparound, saturation, or error-on-overflow behavior.\n\n- **Signed and Unsigned Formats**\n Easily switch between signed and unsigned representations using the `signed` parameter.\n\n- **Consistent Q-Format Notation**\n Follows ARM-style Qm.n notation for compatibility with DSP and embedded tools.\n\n- **Well-Suited for Embedded and DSP Simulation**\n Ideal for preparing and validating fixed-point behavior before deploying to hardware.\n\n## Installation\n\nInstalling it is pretty easy:\n\n```bash\npip install qformatpy\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Simple to use fixed-point library.",
"version": "1.0.2",
"project_urls": {
"Documentation": "https://qformatpy.readthedocs.io/en/latest/",
"Source Code": "https://github.com/ericsmacedo/qformatpy"
},
"split_keywords": [
"dsp",
" fixed-point",
" signal-processing",
" qformat"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "23f4255e3b5bb35c6f79dda95aaa99bfee0b91a16ca19e889e98b541911421fe",
"md5": "cc16535e37dd536c8ab0228159d65a09",
"sha256": "3369d6a1855f46df1b506ca7e382907877b8ec31f252e704ffb6b06eb3a2ca85"
},
"downloads": -1,
"filename": "qformatpy-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cc16535e37dd536c8ab0228159d65a09",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10.0",
"size": 8164,
"upload_time": "2025-07-15T08:34:48",
"upload_time_iso_8601": "2025-07-15T08:34:48.473058Z",
"url": "https://files.pythonhosted.org/packages/23/f4/255e3b5bb35c6f79dda95aaa99bfee0b91a16ca19e889e98b541911421fe/qformatpy-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "421a323e599cd997e7ee6abdabc0a628b314803f2d24f72133564d90f3661ea7",
"md5": "fd577c38e6d9dfbb8181c3ff4c426f2b",
"sha256": "c443eb26365cd99d8d13a0558e7bec5c4db0d5b0cabf2690fe238f8a0f9c9f65"
},
"downloads": -1,
"filename": "qformatpy-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "fd577c38e6d9dfbb8181c3ff4c426f2b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10.0",
"size": 41607,
"upload_time": "2025-07-15T08:34:49",
"upload_time_iso_8601": "2025-07-15T08:34:49.248547Z",
"url": "https://files.pythonhosted.org/packages/42/1a/323e599cd997e7ee6abdabc0a628b314803f2d24f72133564d90f3661ea7/qformatpy-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-15 08:34:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ericsmacedo",
"github_project": "qformatpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "qformatpy"
}