Skip to main content

Posit arithmetic library with no frills

Project description

codecov

posit-playground

Goals:

  • output nice bit representations
  • build posit from_double and from_bits
  • implement basic math operations
    • add/sub
    • mul
    • div

Install

  • stable
pip install posit-playground

Usage

from posit_playground import from_bits, from_double

p1 = from_bits(
    bits=0b000110111011101,
    size=16,
    es=3,
)

p2 = from_double(
    x=2.312,
    size=6,
    es=1,
)

p1 * p1 # implements posit multiplication

or better yet, launch a notebook on binder

Binder

or visit notebooks/1_posit_playground_demo.ipynb

Changelog

See CHANGELOG.md.

Demo

Screenshot of posit-playground in action, with a corner case example in which the exponent is chopped off the bit fields

Imgur

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

posit-playground-0.1.3.tar.gz (10.6 kB view hashes)

Uploaded Source

Built Distribution

posit_playground-0.1.3-py3-none-any.whl (11.0 kB view hashes)

Uploaded Python 3

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