Metadata-Version: 2.4
Name: pyfixed
Version: 0.2.0
Summary: Arbitrary-precision fixed-point library for Python
Author: Shachar Kraus
License-Expression: MIT
Project-URL: homepage, https://shacharkraus.gitlab.io/pyfixed
Project-URL: documentation, https://shacharkraus.gitlab.io/pyfixed
Project-URL: source, https://gitlab.com/ShacharKraus/pyfixed
Project-URL: issues, https://gitlab.com/ShacharKraus/pyfixed/-/issues
Keywords: fixed,fixed point,fixed-point
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib
Requires-Dist: mpmath
Requires-Dist: numpy
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Provides-Extra: docs
Requires-Dist: myst_parser; extra == "docs"
Requires-Dist: pydata_sphinx_theme; extra == "docs"
Requires-Dist: pytest; extra == "docs"
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx_autodoc_typehints; extra == "docs"
Dynamic: license-file

# `pyfixed`

[![Latest Release](https://gitlab.com/ShacharKraus/pyfixed/-/badges/release.svg)](https://gitlab.com/ShacharKraus/pyfixed/-/releases) 

`pyfixed` is an arbitrary-precision fixed-point arithmetics library for Python.  
It currently is in early development.

`pyfixed` is licensed under the [MIT License](./LICENSE).

## Rational

`pyfixed` aims to aid in simulation of fixed-point arithmetics and testing of software and hardware solutions.  
It supports multiple configurations, with the goal of supporting a wide variety of hardware implementations.

`pyfixed` is currently *not* optimized, and has poor real-time performance.  
While optimizations are planned in general, the project does not aim to achieve any performance goals.

## Installation

Install latest:
```bash
pip3 install pyfixed
```

Build from source:
```bash
python -m build
pip3 install dist/*.whl
```

You can also use it directly by adding the root directory to your `PYTHONPATH`.

## Features

- `pyfixed.Fixed`: arbitrary-precision fixed-point.
  - Native API.
  - Simple arithmetic and bitwise operations.
  - 10 rounding modes (see `pyfixed.Fixed.FixedRounding`).
  - Optional exceptions on overflow, underflow and invalid operations (e.g. divide by 0).
    - Sticky exception flags.
  - Support for Python, NumPy and mpmath numeric types (integers and floats).
- `pyfixed.Complex`: arbitrary-precision complex fixed-point.
  - Based on `pyfixed.Fixed`.
  - Fused operations.
    - Doesn't support some operations involving floating point due to inaccuracies.
- `fixed_cmp`: visual comparison between fixed-point, IEEE-754 and posits.

### Planned Features

- Posit support (against [`softposit`](https://pypi.org/project/softposit/)).
- More functions:
  - $e^z$, $ln(z)$ and their derivatives.
  - FFT.
  - Matrix operations.
  - Other DSP-related operations.
