Python bindings for the Overfloat native floating-point runtime
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-> exponent5, mantissa1032-> exponent8, mantissa2364-> exponent11, mantissa52128-> exponent15, mantissa112
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file overfloat-0.1.3.tar.gz.
File metadata
- Download URL: overfloat-0.1.3.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46163737550f9e1d0de4217d7214e07856c8668ddce245143a4930aa54b738eb
|
|
| MD5 |
00049bf7a32da4e0f38a449d1b153570
|
|
| BLAKE2b-256 |
29c16672df3ae563d29b842604fde02296e659125a46c49258c3f6dd8a6bdbac
|
File details
Details for the file overfloat-0.1.3-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: overfloat-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9359af8e41f9dc4909ae8dece6cc60c324079b173f633a9ed5c7788e9e4a4d41
|
|
| MD5 |
789fcdec6b1e40168bda2c74054dbaa9
|
|
| BLAKE2b-256 |
2e504a01ff9e14aae26be534eaa3e4b516787d98066b45c16fec536af7776c65
|
File details
Details for the file overfloat-0.1.3-cp313-cp313-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp313-cp313-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9de69ec39e982022f2ee9c2c15ab3a683b13fc0eb90a4a1b92e0334e3c9d43d1
|
|
| MD5 |
80ba11c012808217205f76d46aac49b2
|
|
| BLAKE2b-256 |
49b4b26137b54da6605873f232c62784fc9df2ebb04269bdb45a97ddbb3776a2
|
File details
Details for the file overfloat-0.1.3-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
197e3af3fc218ecaa77b00992b560f0b1f284be69a0269d2c8fd532c8318c23c
|
|
| MD5 |
db38142accafa31264336cce1b9519d6
|
|
| BLAKE2b-256 |
293a71b8b1ebcc933cf188187098e243acf30a495f3a24e3385777ac09a0e135
|
File details
Details for the file overfloat-0.1.3-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: overfloat-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51ef37489c64128dfd1687b015063a214f38c83efe5e318b69eca0901998a2c4
|
|
| MD5 |
53edecb2b51ebe2d311fbdc323ad6236
|
|
| BLAKE2b-256 |
36e54c65a68519c6b17ea603ff3d795e9b06c88be76e1ebdd4fda753e943c5f4
|
File details
Details for the file overfloat-0.1.3-cp312-cp312-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp312-cp312-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
322697334eb0acb1f55808dd6cee93d135aa805db4063123115710a5036cea75
|
|
| MD5 |
a7848a8401762d5f6e4e633cf2629dfc
|
|
| BLAKE2b-256 |
866f3fbcd6ab7b921270ee73c11a6b71ad283e323488ee3e4582f09f59ac7b9e
|
File details
Details for the file overfloat-0.1.3-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef4eea79b328baab87db9861aa0ed983be857209fd62d1baf902627c1701a22d
|
|
| MD5 |
d4bd09449b766902bd7f67245d8d54df
|
|
| BLAKE2b-256 |
14010ea874699f054eafc1f64eb1f1525eab1a9aae56302882dc5682ed1c21f5
|
File details
Details for the file overfloat-0.1.3-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: overfloat-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3727f6697667445af7faf8823d1ee99d44cd7b0bb0720041996ea69012bb2b68
|
|
| MD5 |
fdb93547695b4ba80e2594bb56735ca5
|
|
| BLAKE2b-256 |
1c59580f255d9a0dd8b24418b0948084ae613383a66caed1f6ddfb8306ea94c0
|
File details
Details for the file overfloat-0.1.3-cp311-cp311-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp311-cp311-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d91d763f33430226882824287145790d73710b0783bfff4d045cb9a820c12f5f
|
|
| MD5 |
fcf2cc5bdc598d3ddc9938879d8e7e9f
|
|
| BLAKE2b-256 |
7dc5b6ab7c5b350fe0999641d786c73938db26d7784a55db9d0faee92f44844d
|
File details
Details for the file overfloat-0.1.3-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b4f25d99d59c1139a32cb72a3b08417f2d22a0544271c75cbe3ebf955245606
|
|
| MD5 |
4911b27ece300e4da0a661289471b8f2
|
|
| BLAKE2b-256 |
5f53c2ae4780ed03909e33dbaef09175d368eab1ecdfecb8782f64c8f700b6f4
|
File details
Details for the file overfloat-0.1.3-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: overfloat-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82c36a5e6821a56097c6f15840bacaeecec1c7cc7eba87384893faa242689d9f
|
|
| MD5 |
0911820c9668b98d1bb4ba3aef84702c
|
|
| BLAKE2b-256 |
1fe9bb3f922d7c73748f023adb7aad86baba3980151f96ebe789456b1415e943
|
File details
Details for the file overfloat-0.1.3-cp310-cp310-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp310-cp310-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f93147e746ca56ccb6d61d52ff7de403aaeb090a7e48ec8edd987850c8253ec3
|
|
| MD5 |
5f49f0d0fd90f7d2a97f2cfe37654854
|
|
| BLAKE2b-256 |
3a9deff950faddddbde8d1de1f599f523f57aeacd5738b1ff900037185268dad
|
File details
Details for the file overfloat-0.1.3-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f9b084271196098b7eb1a287824599487e1f3bef3f2cbfba8c03fe27503c8a
|
|
| MD5 |
6d071f668b169dcf0e21e5a059d8edce
|
|
| BLAKE2b-256 |
3892de437897300dcb69274be514ffe44ca021ca83ded8efe87a0623b369518c
|
File details
Details for the file overfloat-0.1.3-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: overfloat-0.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ca645370ed409fa0169f7f70222d093015a9613ef79d0dca30f7c301498de3f
|
|
| MD5 |
9a814ec3f59d1b399bc8f952d310b14e
|
|
| BLAKE2b-256 |
a63f791576548df5a1aa4542cfa6386781fbcc384293189505913410299082c1
|
File details
Details for the file overfloat-0.1.3-cp39-cp39-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp39-cp39-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac204698c2dc3cc3aad284db59a1412fba04923640ba75591fe156324c7e6d56
|
|
| MD5 |
67fdfb6365a4bb98a7d823e22df987a3
|
|
| BLAKE2b-256 |
44794660d821b44dc837221e09fc2b31eb34453e6a001697d1acc02eca91763b
|
File details
Details for the file overfloat-0.1.3-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: overfloat-0.1.3-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e58a79b3844ee85565fe58c8de29092793d1b7965ec4a4ed1349eac08a777edf
|
|
| MD5 |
4994a9a9bd4c84f44cc214ea490defb4
|
|
| BLAKE2b-256 |
95d856800fa2f1647235c20ff8be29245198708bace553b453d87b69dca08a63
|