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.

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
numfi-0.2.1-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

0.5.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.0.1

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