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

Python bindings for the Overfloat native floating-point runtime. Overfloat is an IEEE 754-oriented arbitrary-precision floating-point library implemented as a .NET Native AOT shared library with a C ABI.

Install

Install from PyPI:

python -m pip install overfloat

The release workflow builds wheels for Python 3.9, 3.10, 3.11, 3.12, and 3.13. Downloaded wheels bundle the native Overfloat shared library for the target platform.

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

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.

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

Build From Source

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

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

Uploaded CPython 3.13Windows x86-64

overfloat-0.1.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

overfloat-0.1.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

overfloat-0.1.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

overfloat-0.1.1-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.1-cp310-cp310-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

overfloat-0.1.1-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.1-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.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: overfloat-0.1.1-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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2f452452c1cef7b058841619634b57a9082725e1942bf884db9028805c638801
MD5 ab4b63bf9cd54cc0354c96490ffcc321
BLAKE2b-256 5287d19d860a9652a57d1090ef19e1a2a3dde6427fbef1995adea830916f0e95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1f5d483c78ca7b9571caceab6aaf2e8b24b5a574fe84f36641205178c05bf282
MD5 919980346ccfb7e6f8d5b7623fd193cc
BLAKE2b-256 92ab2dec6ca488ffdf7910ea9ff07edd0513b4850bc8022ef1eaab55c8bc6517

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cf1aef02bffde36416adb00f042d0cd05f18e9c979241eb805acac9ded183d2d
MD5 8246ce5c7391625238de8a5b604533a6
BLAKE2b-256 5eab69d38d5ec83b06ae5cfb106c8e7dab875533afe30b373f77bde0ea83582b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: overfloat-0.1.1-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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b35eee81cbe414ceb04fd3a881923d6e4aef6c1f1dae935a6aa866a52500352b
MD5 863ff1ad8a5b35826ec1d33813955cd6
BLAKE2b-256 1acfd4a923f2508731e3b68764f6386bed97eaaa702595239f86a0fc5bec5475

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b9ec9c85a6b795167bf4c01700bad3c758094d74f187478698c044567637de28
MD5 fe04cd65c3896c19ef902261e5fd787d
BLAKE2b-256 da023abaa98e7be3f4a8dffa1885f810849a050929c53fde8da893ce1dca042a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2265ff8817d5c1ef1226c88584f95aaee18ff32fb36cabdd01f37b29f81498a
MD5 bec9f07b7e5d1d88460ed6a54eeee5ed
BLAKE2b-256 ded1938e8674ee628b3ed318f3138caff6b5bb12e0a016171b21a7452572563a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: overfloat-0.1.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9c28e054bb918112bd5ea64a59590101d802836e3ec2562275f370716895df80
MD5 a34d240ef464c1f091122e49606a1482
BLAKE2b-256 239b2bc6da6f8070eb075b32a11e67099c169145451bd2e4c3b6a72bb5a0c284

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 50d92454d5484199138ef1621eea058be17c9f5494830c97683915b9b680f698
MD5 3940c2c004593530984cbb4972bbc443
BLAKE2b-256 403227787f7d348223a6047061348fcf29dbb57c064cfe54442f1a76f524b679

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6ef2beb98c539d421aa0138aa61c01b9006cef995fc22f1199cff26738ac864c
MD5 d0d522eed290e9be2168a61b24619dfe
BLAKE2b-256 0608e92661f46cb3558dc9af669f656b480acbed65633d0fc40e4ec426271452

See more details on using hashes here.

File details

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

File metadata

  • Download URL: overfloat-0.1.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0ba5db3c6b5a948f526932c61386d51b4fdc88d93b4460d728d35638725b4bb8
MD5 656b26bd4a69e3440ea6321a23c9a707
BLAKE2b-256 5696e7ce2f409557c0365ed47119dc971d7b5b051887fe01edffd0d1410292d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f911dbb806ab91770626e0417d2d6136af690b2d4494658eb7c730bf93673658
MD5 5a9e78b897d53d2086e36ab7b106c0bd
BLAKE2b-256 d91514cec336376e6637a7c7220e3a1e656a1edd74f0e112eef755ef80a7fe99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a912e4cb851cee5fd4470cb67692ce84811bffd6ee70491e857f7974fd50c45e
MD5 f385d8f444c4a6f47d3a3cab6f8dad85
BLAKE2b-256 a0ecbfbe90e8063194dcb399db0d60971649d026276d1914f8d8e87c26bb4bff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: overfloat-0.1.1-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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d13f0af940bb30e37d671ed9534b31216ebba574c6395a523914a11c38f9d8e1
MD5 50c3af71438589a5b68f0857a00933f0
BLAKE2b-256 1efa4aee1efbf224f4c1ad74bbd5169f7743b731d6e625320fb49f9784b81b06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 0bf43c1d4d770906b86a8cf9140b2967fa09c031fceb8128be3ef85fccb632af
MD5 964a62b45bd7e738bebd68030c8bf2d6
BLAKE2b-256 4bbeee7fbcebfd9b2bc024893b560c4f83d291f204918cf55c20c8c8d1756ed9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for overfloat-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aefe5eb90b518220e585ef3ef83b8f55f52460a3dd9374fec01ce05d6b9fe9fe
MD5 ff3600b80367299c08b8d81f99405070
BLAKE2b-256 537f2cb30a10570a29b59a265d9ce3c6adfaf709282543f11f9effd87e58db71

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