descriptionsoft-float python bindings (berkeley softfloat-3, posit library)
ownergit repository hosting
last changeThu, 18 Jul 2019 13:44:12 +0000 (14:44 +0100)
README.md

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 with CPython 2.7, 3.4, 3.5, 3.6, or 3.7, sfpy should work out of the box:

pip install sfpy

Under the hood, sfpy uses Cython to create bindings for the softposit and softfloat C libraries. The building instructions are tested on Ubuntu 16.04 - for other platforms they may need some adaptation.

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.

shortlog
2019-07-18 Luke Kenneth... correcting use of uint32_t where uint64_t should be... master
2019-07-17 Luke Kenneth... add u/i-32/64 <-> f16/32/64 conversion routines
2018-09-27 Bill Zornbeginning to add tests
2018-09-24 Bill Zornupdate to latest SoftPosit
2018-09-05 Bill Zornremove unneeded -lm option to gcc
2018-09-05 Bill Zorndon't use quire clear macros, hopefully for windows...
2018-09-05 Bill Zornupdate to latest SoftPosit and bump version
2018-09-04 BillUpdate README.md
2018-09-04 Bill Zornupdate to latest SoftPosit and bump version
2018-08-21 Bill Zornbump version
2018-08-21 Bill Zornremove debugging path info
2018-08-21 Bill Zornbump version
2018-08-21 BillUpdate README.md
2018-08-21 Bill Zornfix link so it doesn't have to be local
2018-08-21 Bill Zornoops oops -f so the script won't complain if nothing...
2018-08-21 Bill Zornoops - don't delete the wheels right after building...
...
heads
12 months ago master