Skip to content

[Feature Addition]: NumPy (Python) datatype for posit #363

@anubane

Description

@anubane

I have created a wrapper library to utilize the Posit datatype defined by this project as a custom datatype in NumPy (Python).

In this example file you may observe:

from posit8_2 import posit8_2 as p8    #importing the datatype library in Python

Then the datatype is used as follows:

a = np.array([0.33, 0.25, 0.025, 0.0025, 0.00025], dtype=np.float32)

b = a.astype(p8)    # implicit cast from NumPy float32 to Posit<8,2>

Current problems with the library:

  1. I use an old build procedure
  2. The current vesion is specifically for Posit<8,2>, will need help though, to make it generic

Notwithstanding the above, the library is ready to use, once built (using the present method).

I wanted to inquire the following:

  1. If this is useful for the community
  2. Whether stillwater would want to add this officially

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions