Skip to main content

PyPI Version Python Build Documentation Coverage Status python-versions semantic-versioning

Contributors PRs welcome Issues PRs open PRs done

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.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:

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)

Source distribution for qformatpy 1.0.2
File Size Uploaded
qformatpy-1.0.2.tar.gz 41.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qformatpy 1.0.2
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page