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)
>>> a.sig_bit_magnitude(0), a.sig_bit_magnitude(-1)   # leftmost stored bit, rightmost
(0.5, 1.1920928955078125e-07)
>>> a.implicit_bit_magnitude, a.ulp                   # hidden leading bit, unit in last place
(1.0, 1.1920928955078125e-07)

>>> # 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.6.0

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.6.0
File Actions
py_ieee754-1.6.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for py_ieee754-1.6.0-py3-none-win_arm64.whl
py_ieee754-1.6.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for py_ieee754-1.6.0-py3-none-win_amd64.whl
py_ieee754-1.6.0-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64, Linux glibc 2.31+ x86-64 Details for py_ieee754-1.6.0-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
py_ieee754-1.6.0-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.6.0-py3-none-manylinux_2_31_aarch64.manylinux_2_34_aarch64.whl
py_ieee754-1.6.0-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.6.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
py_ieee754-1.6.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details for py_ieee754-1.6.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
py_ieee754-1.6.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for py_ieee754-1.6.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
py_ieee754-1.6.0-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.5+ x86-64, Linux glibc 2.17+ x86-64 Details for py_ieee754-1.6.0-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
py_ieee754-1.6.0-py3-none-macosx_26_0_x86_64.whl Python 3 none macOS 26.0+ x86-64 Details for py_ieee754-1.6.0-py3-none-macosx_26_0_x86_64.whl
py_ieee754-1.6.0-py3-none-macosx_26_0_arm64.whl Python 3 none macOS 26.0+ ARM64 Details for py_ieee754-1.6.0-py3-none-macosx_26_0_arm64.whl

Total release size: 420.6 kB

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

Download URL py_ieee754-1.6.0-py3-none-win_arm64.whl
Size 39.9 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
bc4e23738ef9cc9e91d2e58c6820cc0a7e64a35532b7e8c58852d2799730d8c7
BLAKE2b-256 checksum
How to use checksums
100a1813e31cbecf424bff3cff5b3dc118ef9c907eafe74e68245ec676c8da25
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-win_amd64.whl
Size 42.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
f5b59b162b81402681547de5ecf408d8893ce8e2bf04eb7679ca0b1355c2222a
BLAKE2b-256 checksum
How to use checksums
9e477a89b602b8383c2976efda8b6749acbd6f979009fca84fe11b4a4d356a5e
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
Size 44.1 kB
Tags Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
1924b5aad3adc6304af122b483602f7e3bb5567f713fd66ce0370fe0761d10e8
BLAKE2b-256 checksum
How to use checksums
07113b3062577d762c99b4dce8ea717ba8c3a7073ec5a42b6737b164a6e21847
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-manylinux_2_31_aarch64.manylinux_2_34_aarch64.whl
Size 42.6 kB
Tags Linux glibc 2.31+ ARM64 Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
061a43da484fb2fdc463277997f21700cd24720a4c56bdf5bd3d99cdb342c05c
BLAKE2b-256 checksum
How to use checksums
9a17b09bc4c41d606736af40c5fadc6838fca64094ea22a4c4abcc0ff4f462c6
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 44.1 kB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7a4f3e26cdc7abb6db6102f434f8bc410fbd32bdc17683c1479e534815c5464e
BLAKE2b-256 checksum
How to use checksums
6adee5a49aaf908195cb58143d453916f557bdaeee2f2262a6b88df6525c0d43
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 42.6 kB
Tags Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
b6e9738ea279a9ca2168ab6b5b67deb3a768fc137d5b356b095bc9359144a1e2
BLAKE2b-256 checksum
How to use checksums
23c321164312de2aa01e59ff040d80bc35e0aa6f51ef4bb0ed05255b8158a976
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 42.1 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
bac1598ef70a1a9a35b013752d1f6c0086a5ef60cdc6d1920b3f36075ce1dfcb
BLAKE2b-256 checksum
How to use checksums
79eb3d0952bce8ea889621f43c1e1405d313178f6270b3dfaff9c97ca0a71bf2
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Size 44.0 kB
Tags Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
18de19db2767e50176110d761c55c899b9ec9b2f957c1dbaf782327595af0544
BLAKE2b-256 checksum
How to use checksums
dd4bd90326b79b334b5618b74b9e503362ce4b99a961e7188d8a55a6ea432e7a
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-macosx_26_0_x86_64.whl
Size 39.3 kB
Tags Python 3 macOS 26.0+ x86-64
SHA-256 checksum
How to use checksums
b60002a48e24983fc81abde4ced30056e33ac993a8542da01b163cbfaeb1f516
BLAKE2b-256 checksum
How to use checksums
f13220e2075aeeeff4c9934df938a6758bc22fa2f4306cb2bee2050348c06e89
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 Sep 17, 2026.

Transparency log

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

Download URL py_ieee754-1.6.0-py3-none-macosx_26_0_arm64.whl
Size 39.4 kB
Tags Python 3 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
0705f3687b6b23686e052030c8b4e50fa31bef12f2dcdd83810e3b9549415486
BLAKE2b-256 checksum
How to use checksums
d28331dee54bcb5dd45b51edd6be95169b5158233a55bb93b0f9949026bffbe1
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 Sep 17, 2026.

Transparency log

Security for py-ieee754 1.6.0

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.6.0-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 Sep 17, 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