Skip to main content

numfi

numfi is a numpy.ndarray subclass that does fixed-point arithmetic.

Feature:

  • Automatically perform fixed-point arithmetic through overloaded operators

  • Maximum compatibility with numpy and other library, just like a normal numpy.ndarray

  • Optimized calculation speed by minimizing quantization as much as possible

Install

Prerequisite: python3 and numpy

pip install numfi

or you can just copy numfi.py and do whatever you want, after all it's only 200 lines of code

Quick start

from numfi import numfi

# numfi(array=[], signed=1, bits_word=32, bits_frac=16, rounding='round', overflow='wrap')
x = numfi(np.random.rand(3,3),1,16,8) 

# any arithmetic operation with numfi will return a numfi object with proper precision and value
y = x + 1 
z = x * 2
w = np.sin(x)
...

Document

Details can be found here: https://numfi.readthedocs.io/en/latest/?

License

The project is licensed under the MIT license.

Metadata

Release files for numfi 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for numfi 0.2.1
File Interpreter ABI Platform Actions
numfi-0.2.1-py3-none-any.whl Python 3 none any Details for numfi-0.2.1-py3-none-any.whl

Release files / numfi-0.2.1-py3-none-any.whl

Download URL numfi-0.2.1-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cb8cbfe0f6d15ee68ea6fa93893739474f7438858a6613f1222dddc7f7f927d
BLAKE2b-256 checksum
How to use checksums
b4643a880a8f25f3e6fd4e01ebee196f8f273ebe9a1ff66e76b61677efbf0fb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Security for numfi 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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