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

Total release size: 401.2 kB

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

Download URL py_ieee754-1.5.0-py3-none-win_arm64.whl
Size 38.0 kB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
a2ccc36e902630c963ce805e3b72c8f79ca6dd3695f001a5295449afa8511b6a
BLAKE2b-256 checksum
How to use checksums
0189c910a75f4b81a08ea231d03f2bac5f11a4ce4a633ad2be7832cdebaa69cd
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-win_amd64.whl
Size 40.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ed8db4a9124a0f5f3ed646ffc74d00fbddfee66ae3d4ad052dc8027ac7d22225
BLAKE2b-256 checksum
How to use checksums
f535b66fcfdcb64dcabbc203f1651a194601815702d5fcec4c84fa50aff12d35
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-manylinux_2_31_x86_64.manylinux_2_34_x86_64.whl
Size 42.1 kB
Tags Linux glibc 2.31+ x86-64 Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
bfe12c10291decdc2081d4b66a3359c17df2ed055706d2e8a573392831ee7131
BLAKE2b-256 checksum
How to use checksums
d157fa2f3ddf8864492f76711e5ce23daa8cb1a55c75247c3675b27fadc0fd53
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-manylinux_2_31_aarch64.manylinux_2_34_aarch64.whl
Size 40.7 kB
Tags Linux glibc 2.31+ ARM64 Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
65490a8142fe7322c74d02bb54f0b8ea3b5de13a8e9a91304b2073e720802697
BLAKE2b-256 checksum
How to use checksums
792cd6348055e6024aa37f4592232df65e6ef4ae18a74725f6ee17d33e6919ce
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 42.1 kB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
98cfcd913821fa4f607bf1d0cada0ac43d5a2bd8e4e2ca86a6fde38ae125fec3
BLAKE2b-256 checksum
How to use checksums
dfeac88a1432afb5be5402d5c526a1bcc1e38e688c334d569e706172e9079df4
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 40.7 kB
Tags Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f32d0b069cfa6f6e3613fa4e25509e1035bf5ba29083e957f2e6b43538ec43ff
BLAKE2b-256 checksum
How to use checksums
12bede5011d0077f0ef6bbf3a8ae5dfff60e1ec62f059f1c526718a7cab2a3b9
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 40.1 kB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
70b761ea959e7e382c04f2bc880e3370db407df6863e16bee30648682fa82a9e
BLAKE2b-256 checksum
How to use checksums
c3ebe64b831b62d5335a23f16750b1b90bfb7464234463515bc61e88cba206d9
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 Jul 31, 2026.

Transparency log

Release files / py_ieee754-1.5.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.5.0-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Size 42.0 kB
Tags Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d02c9b06b6335f2691258dfc6133ff0199711e17837acbcec0c7eee79231cdc3
BLAKE2b-256 checksum
How to use checksums
b6e1957f3a5b80ad7e3781510b401a30557d9cd58b2e8d38053d767c2d4b5b61
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-macosx_26_0_x86_64.whl
Size 37.3 kB
Tags Python 3 macOS 26.0+ x86-64
SHA-256 checksum
How to use checksums
9b010e65e78e8f2402b434ca91204d64ab5843469fe8a23a14b2c432e935c60d
BLAKE2b-256 checksum
How to use checksums
55a61e3eb53bb48c6e4f46898141118441a586a27f29bf4b54ae038dd201ae22
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 Jul 31, 2026.

Transparency log

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

Download URL py_ieee754-1.5.0-py3-none-macosx_26_0_arm64.whl
Size 37.5 kB
Tags Python 3 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
3a7865fdfaabee88bb9ca4df30db7736cb9d26127e270b7926e9b47d2c4ddbd9
BLAKE2b-256 checksum
How to use checksums
61b1fdff642870b2147f70f759d13dbb1d440778bc1edcf7d05edd6760ab63cd
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 Jul 31, 2026.

Transparency log

Security for py-ieee754 1.5.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.5.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 Jul 31, 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