fxpmath
A python library for fractional fixed-point (base 2) arithmetic and binary manipulation with Numpy compatibility.
What it is and what it does
Fxpmath is a Python library for simulating fixed-point arithmetic in software, mimicking hardware behavior on FPGAs and DSP systems. It represents numbers with configurable word length and fractional bit positions, supporting signed and unsigned formats, and works seamlessly with numpy arrays and operations.
The library handles the full lifecycle of fixed-point values: creation from multiple input types (int, float, complex, strings in binary/hex/decimal, numpy arrays), arithmetic and bitwise operations, configurable rounding and overflow behaviors, and output in multiple bases. It tracks status flags and precision loss, making it useful for algorithm prototyping before hardware implementation or for educational exploration of fixed-point behavior.
Use it for:
- Prototype DSP algorithms in Python before deploying to fixed-point hardware or FPGA
- Simulate fixed-point quantization effects on signal processing pipelines to predict hardware behavior
- Test arithmetic overflow and underflow handling strategies with configurable saturation and rounding modes
- Verify bit-width requirements for embedded systems by experimenting with different word and fractional sizes
- Teach fixed-point representation and binary arithmetic concepts with interactive examples
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Fxpmath provides fixed-point arithmetic with arbitrary word and fractional sizes, supporting signed and unsigned numbers, numpy arrays, and bitwise operations for DSP and FPGA applications.
Yes. Fxpmath is actively maintained, has no known vulnerabilities, installs with minimal friction (numpy only), and fills a specific niche for fixed-point algorithm development and FPGA prototyping. The MIT license and stable API make it suitable for both research and production use. Install if you need to simulate or verify fixed-point behavior before hardware implementation.
Install
fxpmath on PyPI
pip
pip install fxpmathuv
uv add fxpmathpoetry
poetry add fxpmathInstalling fxpmath
Before you install
Low friction: pure Python wheel with only numpy as a runtime dependency. Active maintenance with recent releases; last commit 2026-04-04 and 206 repository stars indicate ongoing development.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install fxpmath
from fxpmath import Fxp
import numpy as np
x = Fxp(-7.25, signed=True, n_word=16, n_frac=8)
y = x + 2.5
print(x.bin(frac_dot=True))
Requires Python >= 3.7; numpy must be installed.
Verify before relying
- Performance characteristics for large arrays or complex operations compared to alternatives
- Numerical accuracy guarantees under various rounding and overflow configurations
- Active user community size and response time for issues beyond the 206 GitHub stars
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 143 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 194,177/month — #9,843 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fxpmath-0.4.10-py3-none-any.whl
Keywords: fixed point, fractional, math, python, fxpmath, fxp, arithmetic, FPGA, DSP
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
fixedintProvides fixed-width integer classes that…
permissive · top 5,000 on PyPI
bitarray-hardbyteProvides an efficient C-backed array type for…
permissive · top 15,000 on PyPI
ml-dtypesml_dtypes provides NumPy-compatible data types…
permissive · top 1,000 on PyPI
bitmathbitmath converts and performs arithmetic on…
permissive · top 15,000 on PyPI
numkongNumKong provides mixed-precision linear algebra…
permissive · top 15,000 on PyPI
cintWraps ctypes integer types to perform…
permissive · top 5,000 on PyPI
numexprNumExpr evaluates numerical expressions on…
permissive · top 5,000 on PyPI
bitarrayProvides an efficient C-backed array type for…
permissive · top 1,000 on PyPI