Skip to main content

Python package for custom fixed-point and floating-point formats

Project description

APyTypes

PyPI pre-commit.ci status License Workflow Status codecov DOI

APyTypes is a Python library providing algorithmic scalar and array data types, both fixed- and floating-point in Python. The main purpose is to simplify finite word length design and simulation. Written in C++, the focus is on performance and flexibility.

Documentation

https://apytypes.github.io/apytypes/

Installation

APyTypes is available in the Python Package Index and can be installed with the pip package installer:

pip install apytypes

Running

The package can now be used as:

$ python
>>> from apytypes import APyFixed
>>> fx_a = APyFixed.from_float(3.5, 4, 4)
>>> print(fx_a)
3.5
>>> fx_a
APyFixed(56, bits=8, int_bits=4)
>>> fx_b = APyFixed.from_float(1.25, 3, 6)
>>> fx_a + fx_b
APyFixed(304, bits=11, int_bits=5)
>>> print(fx_a + fx_b)
4.75

Tests

Test dependencies can be installed by running pip install [.test] and then executed by pytest.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apytypes-0.2.1.tar.gz (313.9 kB view hashes)

Uploaded Source

Built Distributions

apytypes-0.2.1-cp312-cp312-win_amd64.whl (398.6 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

apytypes-0.2.1-cp312-cp312-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

apytypes-0.2.1-cp312-cp312-musllinux_1_2_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ i686

apytypes-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (615.1 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

apytypes-0.2.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (662.1 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

apytypes-0.2.1-cp312-cp312-macosx_11_0_arm64.whl (449.3 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

apytypes-0.2.1-cp312-cp312-macosx_10_14_x86_64.whl (565.0 kB view hashes)

Uploaded CPython 3.12 macOS 10.14+ x86-64

apytypes-0.2.1-cp311-cp311-win_amd64.whl (398.9 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

apytypes-0.2.1-cp311-cp311-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

apytypes-0.2.1-cp311-cp311-musllinux_1_2_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ i686

apytypes-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (618.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

apytypes-0.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (669.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

apytypes-0.2.1-cp311-cp311-macosx_11_0_arm64.whl (449.2 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

apytypes-0.2.1-cp311-cp311-macosx_10_14_x86_64.whl (561.7 kB view hashes)

Uploaded CPython 3.11 macOS 10.14+ x86-64

apytypes-0.2.1-cp310-cp310-win_amd64.whl (399.0 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

apytypes-0.2.1-cp310-cp310-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

apytypes-0.2.1-cp310-cp310-musllinux_1_2_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ i686

apytypes-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (619.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

apytypes-0.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (670.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

apytypes-0.2.1-cp310-cp310-macosx_11_0_arm64.whl (449.3 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

apytypes-0.2.1-cp310-cp310-macosx_10_14_x86_64.whl (562.0 kB view hashes)

Uploaded CPython 3.10 macOS 10.14+ x86-64

apytypes-0.2.1-cp39-cp39-win_amd64.whl (399.5 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

apytypes-0.2.1-cp39-cp39-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

apytypes-0.2.1-cp39-cp39-musllinux_1_2_i686.whl (1.7 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ i686

apytypes-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (620.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

apytypes-0.2.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (669.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

apytypes-0.2.1-cp39-cp39-macosx_11_0_arm64.whl (449.4 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

apytypes-0.2.1-cp39-cp39-macosx_10_14_x86_64.whl (562.1 kB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page