sfpy
softfloat and softposit in Python
- support for softfloat float16, float32, and float64
- support for softposit posit8, quire8, posit16, quire16, posit32, and quire32
Installation
On most linux distros, sfpy should work out of the box:
pip install sfpy
Binary wheels (compatible with manylinux1) are available for CPython 2.7, 3.5, 3.6, and 3.7.
Under the hood, sfpy uses Cython to create bindings for the softposit and softfloat C libraries. These building instructions are tested on Ubuntu 18.04 - for other platforms they may need some adaptation. The cythonized C and compiled static libraries (.a), as well as necessary headers, are included in the source releases; installing these does not require Cython.
Demo
>>> import sfpy
>>> from sfpy import *
>>> a, b = Float16(1.3), Float16(1.4)
>>> a * b - a / b
Float16(0.89208984375)
>>> sfpy.float.flag_get_inexact()
True
>>> a += b
>>> a
Float16(2.69921875)
>>>
>>> x, y = Posit16(3.0), Posit16(3)
>>> x
Posit16(3.0)
>>> x.bits
22528
>>> y
Posit16(2.9802322387695312e-08)
>>> y.bits
3
>>> x * y
Posit16(8.940696716308594e-08)
>>> acc = Posit16(0)
>>> for i in range(10000):
... acc = acc.fma(x, y)
...
>>> acc
Posit16(1.9073486328125e-06)
>>> acc.bits
24
>>> q = Quire16(0)
>>> for i in range(10000):
... q.iqma(x, y)
...
>>> q
Quire16(0.00089263916015625)
>>> q.bits
64424509440000
>>> q.to_posit()
Posit16(0.00089263916015625)
>>> q.to_posit().bits
490
Building
See BUILDING.
Metadata
Release files for sfpy 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sfpy-0.6.0.tar.gz | 343.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| sfpy-0.6.0-cp37-cp37m-manylinux1_x86_64.whl | CPython 3.7 | CPython 3.7 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| sfpy-0.6.0-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| sfpy-0.6.0-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| sfpy-0.6.0-cp34-cp34m-manylinux1_x86_64.whl | CPython 3.4 | CPython 3.4 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| sfpy-0.6.0-cp27-cp27mu-manylinux1_x86_64.whl | CPython 2.7 | CPython 2.7 pymalloc wide-unicode | Linux glibc 2.5+ x86-64 | Details |
| sfpy-0.6.0-cp27-cp27m-manylinux1_x86_64.whl | CPython 2.7 | CPython 2.7 pymalloc | Linux glibc 2.5+ x86-64 | Details |
Total release size: 7.4 MB
Release files / sfpy-0.6.0.tar.gz
| Download URL | sfpy-0.6.0.tar.gz |
|---|---|
| Size | 343.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9e6643dbc51d0c091fb6a0cf998612adf6c45be8ea699fe7af53abb91d194ca
|
|
BLAKE2b-256 checksum How to use checksums |
849bcb03a3909761acf1acfd756b43ec121c665fbaa66bcfd41b74aedbb5176e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / sfpy-0.6.0-cp37-cp37m-manylinux1_x86_64.whl
| Download URL | sfpy-0.6.0-cp37-cp37m-manylinux1_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
3f6e45c355bcd0e0d7af7d834c610cf5ff279114103826c1cfb4e97a3d634b51
|
|
BLAKE2b-256 checksum How to use checksums |
76080aa8788d07eb7b808dee9ab8b9d3384f46d711dcd2d115d8da893e0c5a89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / sfpy-0.6.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | sfpy-0.6.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
85bb68a3837830e2ce99963d4ca7bf62d508357986ba78d531cc9f86cbe5b8a8
|
|
BLAKE2b-256 checksum How to use checksums |
ac857de8b9b566dfe5597e81cb3e60a22f0091531c57c4894b55167103c6f81a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / sfpy-0.6.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | sfpy-0.6.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
65ed2eb92dccde52480e1b51f47283f6e553d3c83f2727558992dfb7b868a6ef
|
|
BLAKE2b-256 checksum How to use checksums |
418d453be0935d80ab5eea518980c77c3d9c5b2c617ff8074b52ae3e1b15334c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / sfpy-0.6.0-cp34-cp34m-manylinux1_x86_64.whl
| Download URL | sfpy-0.6.0-cp34-cp34m-manylinux1_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.4 CPython 3.4 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
39dc569ab5afd9eae026568532e9daa935b2599149a031b369e2d0c115465597
|
|
BLAKE2b-256 checksum How to use checksums |
2a78084f318b011caf254eaa144a47339e464f62b136da37f4505a65588e65ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / sfpy-0.6.0-cp27-cp27mu-manylinux1_x86_64.whl
| Download URL | sfpy-0.6.0-cp27-cp27mu-manylinux1_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
5c5c6693a27998497177e1c7846bb10e722b710aa647a77fb2324bc11447edd3
|
|
BLAKE2b-256 checksum How to use checksums |
e2543946f40b31ab9095185c293b42db234a2ef7569b87cec7ce0196e8fcc51e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / sfpy-0.6.0-cp27-cp27m-manylinux1_x86_64.whl
| Download URL | sfpy-0.6.0-cp27-cp27m-manylinux1_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
6927550d91788f4ad13c84a794fe82fc05335b76834d51411be1dd8b952450e8
|
|
BLAKE2b-256 checksum How to use checksums |
41d207f3c1a124403859372c159e8d98624b4cbb678811db8237c151bf190547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|