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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file posit-playground-0.1.3.tar.gz.

File metadata

  • Download URL: posit-playground-0.1.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/19.6.0

File hashes

Hashes for posit-playground-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b0657d1741af8343211f1beef809c35164429aa46a6fd31e70b8bfb7d7fe70a1
MD5 be84e042885b146a00497236c98800f8
BLAKE2b-256 730bc86ffc2b9dd88b68776212e591e1856d878cb4bf9194a3a5f4d92224a534

See more details on using hashes here.

File details

Details for the file posit_playground-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: posit_playground-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/19.6.0

File hashes

Hashes for posit_playground-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c407dc291746fbb1de26c67b21228ff7f1cc7b475c9d430da562421337dfbfa0
MD5 6cf125075eeced207d2484f94cb37f7b
BLAKE2b-256 8fa3f277aa03c42e63b71422b740ed68a751f1afef280f794d7d135d35eb1234

See more details on using hashes here.

Supported by

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