Skip to main content

py_ieee754

cov

IEEE 754 float number python module with bit-operation and round arithmetic support.

Install

$ pip install py-ieee754

Note

I write this module with vibe coding, but I carefully read every line in src (except the _math <math.h> binding module, which is full of tedious binding code).

I found some bug when I review AI's code, so there might be more. Use with care. I really recommend you to check the code part you are using (usually very short). Bug report is welcomed.

Also note the terminology about "exponent" and "biased exponent".

IEEE 754 says:

biased exponent: The sum of the exponent and a constant (bias) chosen to make the biased exponent’s range non-negative.

  • "biased exponent" E means the raw exp bit pattern interpreted as a uint, i.e. E = e + bias for normalized float, E = 0 for denormalized float.
  • "exponent" e means the exponent, e = 1 - bias for denormalized float

Usage

>>> import py_ieee754 as pi7
>>> import ctypes as ct

>>> # Construction
>>> pi7.F32(1.5)
F32(0b0_01111111_10000000000000000000000)
>>> pi7.F64.from_components("0", "0"*11, "1"*52)# construct from sign, exp and sig bits
F64(0b0_00000000000_1111111111111111111111111111111111111111111111111111)
>>> pi7.F64.from_components("0", "0"*11, -1)    # use -1 to fill specific part with 1
F64(0b0_00000000000_1111111111111111111111111111111111111111111111111111)
>>> pi7.F32.from_bits(0x3FC00000)               # from bit pattern
F32(0b0_01111111_10000000000000000000000)
>>> pi7.IEEE754.from_ctypes(ct.c_float(1.5))    # auto-dispatch (→ F32)
F32(0b0_01111111_10000000000000000000000)

>>> # Field access & classification
>>> a = pi7.F32(1.5)
>>> a.sign, a.exponent, a.biased_exponent, a.significand, a.bits
(0, 0, 127, 4194304, 1069547520)
>>> a.is_nan, a.is_inf, a.is_zero, a.is_subnormal, a.is_normal
(False, False, False, False, True)

>>> # Arithmetic with rounding
>>> pi7.mul(pi7.F32(1.5), pi7.F32("0b1"), round_mode=pi7.RoundingMode.DOWNWARD)
F32(0b0_00000000_00000000000000000000001)

>>> # math.h functions with ctypes interface, round control and fenv exceptions
>>> pi7.math.sqrt(ct.c_double(2.0))
c_double(1.4142135623730951)
>>> pi7.math.fma(
            ct.c_double(1.5), 
            pi7.F64.from_bits(1).ctypes_value, 
            ct.c_double(0), 
            round_mode=pi7.RoundingMode.DOWNWARD)
c_double(5e-324) # = bit 0b1

>>> # interop with numpy
>>> import numpy as np
>>> np.array([pi7.F32(1.5), pi7.F32(1.6), pi7.F32(1.7)], dtype=pi7.F32)
array([1.5, 1.6, 1.7], dtype=float32)

Metadata

Release files for py-ieee754 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for py-ieee754 1.5.1
File Actions
py_ieee754-1.5.1-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for py_ieee754-1.5.1-py3-none-win_arm64.whl
py_ieee754-1.5.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for py_ieee754-1.5.1-py3-none-win_amd64.whl
py_ieee754-1.5.1-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.31+ x86-64, Linux glibc 2.34+ x86-64 Details for py_ieee754-1.5.1-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
py_ieee754-1.5.1-py3-none-manylinux_2_31_aarch64.manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64, Linux glibc 2.31+ ARM64 Details for py_ieee754-1.5.1-py3-none-manylinux_2_31_aarch64.manylinux_2_34_aarch64.whl
py_ieee754-1.5.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for py_ieee754-1.5.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
py_ieee754-1.5.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.27+ ARM64, Linux glibc 2.28+ ARM64 Details for py_ieee754-1.5.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
py_ieee754-1.5.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for py_ieee754-1.5.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
py_ieee754-1.5.1-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 Details for py_ieee754-1.5.1-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
py_ieee754-1.5.1-py3-none-macosx_26_0_x86_64.whl Python 3 none macOS 26.0+ x86-64 Details for py_ieee754-1.5.1-py3-none-macosx_26_0_x86_64.whl
py_ieee754-1.5.1-py3-none-macosx_26_0_arm64.whl Python 3 none macOS 26.0+ ARM64 Details for py_ieee754-1.5.1-py3-none-macosx_26_0_arm64.whl

Total release size: 403.8 kB

Release files / py_ieee754-1.5.1-py3-none-win_arm64.whl

Download URL py_ieee754-1.5.1-py3-none-win_arm64.whl
Size 38.2 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
c49e49ebc3a11130bea68632100a9feddca861bfc227b4f233136142bc81ea85
BLAKE2b-256 checksum
How to use checksums
2db7c286cee7919748134d194392a1e5e0b5ad0071bbed0401440470438a1e37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-win_amd64.whl

Download URL py_ieee754-1.5.1-py3-none-win_amd64.whl
Size 40.9 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
fff8792f76c86448441e609f514ae725638a2730153760e715bb6e795b1dfad6
BLAKE2b-256 checksum
How to use checksums
dce290b0c75b2830f9f595a19cec6b324d606701b3f9164562a39a6196ea9e8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl

Download URL py_ieee754-1.5.1-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
Size 42.4 kB
Tags Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
1d68cefbdd19a5c997c91d2960ebd282fa9ad563fe6e9a42281d6ad5dec3e242
BLAKE2b-256 checksum
How to use checksums
ac335ead854ffcb17e69226881bc0a05a31070318fc735da40c81bb6f869e3d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-manylinux_2_31_aarch64.manylinux_2_34_aarch64.whl

Download URL py_ieee754-1.5.1-py3-none-manylinux_2_31_aarch64.manylinux_2_34_aarch64.whl
Size 41.0 kB
Tags Linux glibc 2.31+ ARM64 Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
710e9924671ed2a9ffdf8f665b5cf0e39a9702d37f4a1c27d5e72c9945904896
BLAKE2b-256 checksum
How to use checksums
92d8a98803e0f3749493aa0830415bb7fc119bff320ac265714094fad12d468f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL py_ieee754-1.5.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 42.4 kB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
96007b650b9cc7c83c92d71106b86f4fa64231068015c66f67a6fbdb7c99a0c5
BLAKE2b-256 checksum
How to use checksums
8c3e14db40e6abe1e3be78aba4fb38a02ce508744f309081b58644e03f865050
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL py_ieee754-1.5.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 40.9 kB
Tags Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c6cfc6210ab72700fe4352114fdefdf25b70d9175bc81141a5a9a69a902b82e4
BLAKE2b-256 checksum
How to use checksums
4347902b694da9ccd10b9f0c48df7de266d04731cb6c4bea5d684102218c8385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL py_ieee754-1.5.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 40.4 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
31d2d9f7fe795b4f64f33a00bb7fdb395bb588f42efe0a89b38a98429a100caf
BLAKE2b-256 checksum
How to use checksums
d8edb121517a542efea9a9041e0a357ad7f63c5541bcee037301f9616dde1268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl

Download URL py_ieee754-1.5.1-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Size 42.3 kB
Tags Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
51019b6551050c5e1198b767d54f8cdb7ec5961dc67704393067c5939d721004
BLAKE2b-256 checksum
How to use checksums
0f736efb37a4269365478e6f41697262300f937d9abeca088f4216abe539e28b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-macosx_26_0_x86_64.whl

Download URL py_ieee754-1.5.1-py3-none-macosx_26_0_x86_64.whl
Size 37.6 kB
Tags Python 3 macOS 26.0+ x86-64
SHA-256 checksum
How to use checksums
97bc71a30eef45cf38652f7400695e72da131aaae0d035cc3dda91976ee8c6f2
BLAKE2b-256 checksum
How to use checksums
ea54ad358f0647c137922ba096e0ebc1c1d4926befa0c01246ceb1c36f30e1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / py_ieee754-1.5.1-py3-none-macosx_26_0_arm64.whl

Download URL py_ieee754-1.5.1-py3-none-macosx_26_0_arm64.whl
Size 37.8 kB
Tags Python 3 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
1d4803833e9e6965f56df9ba57fa799482b5a026b1f9e4f3d9d4257003f720b2
BLAKE2b-256 checksum
How to use checksums
f2a181c02037c85a5f96ef8efc84b4794fc020ad5c31f281a04495aabf104bf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Security for py-ieee754 1.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for py_ieee754-1.5.1-py3-none-win_arm64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page