Skip to main content

Python bindings for the Overfloat native floating-point runtime

Reason this release was yanked:

Incorrect repository URL. Please use version 0.1.3 or later.

Project description

overfloat

Overfloat is an IEEE 754-oriented arbitrary-precision floating-point runtime with Python bindings. The Python package installs like a normal Python dependency while loading a bundled native library through ctypes.

Use it when you want custom floating-point formats without manually wiring up a native shared library.

Highlights:

  • install with pip install overfloat
  • native library bundled in the wheel
  • custom exponent and mantissa widths
  • convenient IEEE-style presets for 16, 32, 64, and 128 total bits
  • decimal parsing, exact formatting, arithmetic, comparisons, classifications, and bit-pattern round trips

Install

Install from PyPI:

pip install overfloat

If pip is not on PATH, use python -m pip install overfloat instead.

The PyPI wheels bundle the native Overfloat shared library for the target platform.

Use the wheel files attached to GitHub Releases only when you need manual downloads, offline installation, or release troubleshooting. The release workflow builds wheels for Python 3.9, 3.10, 3.11, 3.12, and 3.13.

Typical wheel names:

  • Windows: overfloat-<version>-cp<python>-cp<python>-win_amd64.whl
  • Linux: overfloat-<version>-cp<python>-cp<python>-manylinux_..._x86_64.whl
  • macOS: overfloat-<version>-cp<python>-cp<python>-macosx_11_0_arm64.whl

For example, Python 3.9 uses cp39, Python 3.10 uses cp310, Python 3.11 uses cp311, Python 3.12 uses cp312, and Python 3.13 uses cp313.

Usage

The default path is intentionally simple: import the library, create a format, then create numbers from strings or Python numeric values.

from overfloat import OverfloatLibrary

lib = OverfloatLibrary()
spec = lib.create_spec_from_total_bits(32)

a = spec("1.5")
b = spec("2.25")

print(a + b)
print(a * b)
print(spec("1") / spec("10"))

OverfloatLibrary() loads the bundled native library by default. You can also pass an explicit shared library path.

The Python package version is exposed as overfloat.__version__.

Advanced Usage

import overfloat
from overfloat import OverfloatLibrary

lib = OverfloatLibrary()
spec = lib.create_spec_from_total_bits(4096)
manual_spec = lib.create_spec(43, 4048)

a = spec("1.5")
b = spec("2.25")
manual_value = manual_spec("1.5")

print(lib.version)
print(overfloat.__version__)
print(spec.exponent_bits)
print(spec.mantissa_bits)
print(a + b)
print(a * b)
print(spec("1") / spec("10"))
print(manual_spec.exponent_bits)
print(manual_spec.mantissa_bits)
print(manual_value)
print(a.to_bits_hex())
print(spec.from_bits_hex(a.to_bits_hex()))
print(a.compare(b))
print(a.compare_total(b))
print(lib.exception_flags)

create_spec_from_total_bits(total_bits) is the convenient preset form.

create_spec(exponent_bits, mantissa_bits) is the manual form when the exponent width and mantissa width need to be set directly.

Built-in preset formats:

  • 16 -> exponent 5, mantissa 10
  • 32 -> exponent 8, mantissa 23
  • 64 -> exponent 11, mantissa 52
  • 128 -> exponent 15, mantissa 112

These preset values match the IEEE 754 standard formats. For IEEE 754-2008 interchange-style formats with k >= 128 and k a multiple of 32, create_spec_from_total_bits(k) follows the standard width derivation.

For explicit lifetime management:

from overfloat import OverfloatLibrary

lib = OverfloatLibrary()

with lib.create_spec_from_total_bits(4096) as spec:
    with spec("1.5") as value:
        print(value)

Manual Builds

The prebuilt wheels are the recommended installation path. The source distribution can also build a platform native library during installation, but that path requires the .NET 8 SDK and a platform toolchain supported by .NET Native AOT.

If you are building this repository manually, build or copy the platform native library into overfloat/ before creating a wheel or loading the package with OverfloatLibrary().

Windows example:

dotnet publish .\Overfloat.csproj -c Release -r win-x64
Copy-Item .\bin\Release\net8.0\win-x64\publish\Overfloat.dll .\python\overfloat\overfloat.dll -Force
Set-Location .\python
python -m build --wheel --outdir dist .

License

Apache-2.0

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

overfloat-0.1.2.tar.gz (24.1 kB view details)

Uploaded Source

Built Distributions

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

overfloat-0.1.2-cp313-cp313-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.13Windows x86-64

overfloat-0.1.2-cp313-cp313-manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

overfloat-0.1.2-cp313-cp313-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

overfloat-0.1.2-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86-64

overfloat-0.1.2-cp312-cp312-manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

overfloat-0.1.2-cp312-cp312-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

overfloat-0.1.2-cp311-cp311-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.11Windows x86-64

overfloat-0.1.2-cp311-cp311-manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

overfloat-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

overfloat-0.1.2-cp310-cp310-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.10Windows x86-64

overfloat-0.1.2-cp310-cp310-manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

overfloat-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

overfloat-0.1.2-cp39-cp39-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.9Windows x86-64

overfloat-0.1.2-cp39-cp39-manylinux_2_17_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

overfloat-0.1.2-cp39-cp39-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file overfloat-0.1.2.tar.gz.

File metadata

  • Download URL: overfloat-0.1.2.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for overfloat-0.1.2.tar.gz
Algorithm Hash digest
SHA256 16904147393f6258642fd20dcf9f015dac4dd96784a9bafe70cb822faf96e7fe
MD5 3468324d1b3543645f0b501221fbd87c
BLAKE2b-256 ae8785a70a83e1f25d2fa657745361f94dc1275248c4d3bab87ff4ba533e6754

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: overfloat-0.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for overfloat-0.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f1e51ad2ede8f346ffd728ba228fc8a72a1b67b629f17694e7ababfd18261de0
MD5 d9558b452fc9b0cf1ec0fec41796b6fe
BLAKE2b-256 3aeab6e0472df648b93428af27bded514f6744e1cd36157a13fbd8ab3b073660

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8902d5a42910cdcb5e7d5637675e04015fd874974c4ebf35ff0cea5cd249c195
MD5 c546f92691cb468bead34b4fe74bf012
BLAKE2b-256 c670d6d3530fdb39b3d73ade2c9dd236a135a6346d5d59fe6c5c9ef6883fe870

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fbcd03ae6769b66badade85ee4a52637c0ec135b1c3e60491557e1813d40b9ed
MD5 2d54ac316da6235234e2ec5201283df6
BLAKE2b-256 6a8519841cef500b62acfcb2f9efa6ef9082c042144bd3c73a5e4efac8c16551

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: overfloat-0.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for overfloat-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d164d80bd923a933a500885a5c13a19abb4e946cf3f03dcc14eb472c7d285172
MD5 24862171978cc9ed89e301059c5e6c2f
BLAKE2b-256 8b60ca892a46d57f6a689c9b0dd510d71d0c7c7aecb527b8daa50bc410886f38

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e17089436d43cabdf491a798e7cdc4f501333c2d3b0928be9f4619470eb2df4b
MD5 7f1e78320222520df15216fd32e7ddb7
BLAKE2b-256 e825542d33ea99033ae59f7971e08dd1c4970d6d50cb9773f3ac8266698043a9

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a74e25019f05696d6e42b13e47758f06068e95b9d1fc235f4f1f1d5762a70c75
MD5 6b363f5b4b6d582d6a23290bc077dee4
BLAKE2b-256 113486ce51acbf7328064071a8d264efa9073730e09d439d6c1f33cbfca5a46a

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: overfloat-0.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for overfloat-0.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bcd2dada4a043463e59e861cdc8f37343190ee880a34acd753b16ffb680b8e51
MD5 11e63388f9e16a29f6eea20b56ab9d9a
BLAKE2b-256 de0d47f667b2878be55c18217c4fe0188e5cbfaa8f0afee6f1e72df4d84122d8

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e6b3f9d2821672521e286e631c8c383f5aba9f70a506b4a7e0fa4fd0eed8be05
MD5 b3ad28143af3c8ad7dd76a04a8689849
BLAKE2b-256 c16dd1b866c1a5baf43cfbb97100e470de9a7c0959bd789df520ad49f7726655

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed78aab215cb8063d19eb722d86ef3b45fe66aa000db77533b3c6c6e9e4a3e70
MD5 5e2f7a4f8029e68cde9f59051cd41db0
BLAKE2b-256 cda461c481e97d67170e9ee7f8846150f50d119f85825f378ad03de4b1522991

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: overfloat-0.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for overfloat-0.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 55aa41c9aeb42418b43450fa2b3f7d03567a144527d2ddc2e871a0316fe72273
MD5 ff21ab9ba4b4e21fd474f3b10f638e8e
BLAKE2b-256 f61ae7f06424370c23d255e75d20e283c509011cd68f43d81146b373554f41a0

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6b0330d3287a1ea30b1a09e099adfc0a02058b903e556ebfcf0ba4a077eec5d0
MD5 0c3b99d8d0f3520a28321cc101bea173
BLAKE2b-256 a4e398ff640a59dcefb747568a8e4711e79157687be7017c64c54663b15ef8b9

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 71c734c9a7c4c7e17dae7c2e397626c8f1045adb5b6547cff970329b92fecfdd
MD5 33b76f5440cb772b08fa768f5442d163
BLAKE2b-256 f4a9d50b78cd07682c7a83df9fa8738175b3858797de86b332912d37844e67ac

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: overfloat-0.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for overfloat-0.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f5d12ae6f144d233c1955f4ed244c235d1f74877b60ed9f9d95bede1a0246b86
MD5 25fda743111861ec68a03af826ae84c8
BLAKE2b-256 f7717e131de261eec0ec282fc0f1368cfa6309faf1b9bd25b48d335eecb96f97

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fec297b86098ee13271de208380727166a4a09b82ea33fd12e49cadee22adbdb
MD5 42553c43484376788ee7986a5e263d9d
BLAKE2b-256 001efec47aa7d5e9dac56428a02a2e7e4973c7550fdf070d1fe7c5c6dd85fae7

See more details on using hashes here.

File details

Details for the file overfloat-0.1.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for overfloat-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8668688ba1e504989ba974edb99873974a553997ad957d9a12cc00237163fc0f
MD5 3c2e7b4604694cb50aa1804134656e3a
BLAKE2b-256 9af5d52a6213889c53dbbb3dc5bf401068526fd5faf6a303edbc5672145d870f

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