Skip to main content

bf16

BF16 is a Python package for converting floating-point numbers to BFloat16 format using optimized Windows x86-64 assembly.

Live Data

Pepy.tech data

PyPI DownloadsPyPI DownloadsPyPI Downloads

Github.com data

Stars Forks Open Issues Open PRs License Repo Size Top Language Code Size Last Commit Commit Activity Contributors Followers Watchers

Pypi.org data

PyPI Version Python Versions

Socket.dev data

Socket

Virustotal Scan Results

VirusTotal

More Badges

Platform Dependencies CPU Instruction Set Security Policy

Installation

To install bf16 the 2 easiest options are either run this command:

pip install bf16

or click this button to download a zip containing only necessary files to download and also extract it: Download bf16.zip

Usage

import bf16

x = bf16.bfloat16(3.14)
print(x)  # Outputs the BFloat16 approximation as a float and for the record it also actually output 3.125 because its a real brain-float16
print(f"Size: {len(x.data)} bytes")  # Always 2 bytes

Requirements

  • Windows AMD x86-64
  • Python 3.6+
  • cffi The package includes a compiled assembly executable for fast conversion.

Acknowledgments

  • Thank you to Tomasz Grysztar for his work on FASM which made it possible to optimize bf16.dll and make it smaller
  • Jeremy Gordon thank you for making golink which helped with earlier versions of bf16

Changelog

1.0.1

bf16 has completely changed with the last update here is the main stuff

  • added nearly all operators that function that exist within float32 to bfloat16
  • instead of bf16.obj and bf16.exe it is now just a bf16.dll
  • optimized to not have to open and exit bf16.dll everytime
  • added Changelog
  • added acknowlegement to golink I forgot

1.0.2

bf16 has gained a way for people to know they are downloading a safe package

  • corrected README.md old changelog for 1.0.1
  • added repo and its link

1.0.3

bf16 now has more verified details

  • added more verified details
  • made SECURITY.md workflow and CODEOWNERS

1.0.4

bf16 now has finished documentation.

  • Finished community Standards
  • Added downloading Zip file allowing you to only download only necessary files saving memory including README.md, LICENSE, bf16/__init__.py, and bf16/bf16.dll NOTE: go to [[CHANGELOG.md]] for more specific information on the changelog

1.0.5

bf16 is now much faster!

  • optimized bf16.dll by using vectorization merged functions and merged sections
  • switched from GoLink&NASM to FASM for increased speed and smaller dll
  • at the cost of adding a dependency uses cffi to make __init__.py much faster

Metadata

Release files for bf16 1.0.5

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

Built distribution (wheel)

Table of built distributions (wheels) for bf16 1.0.5
File Interpreter ABI Platform
bf16-1.0.5-py3-none-any.whl Python 3 none any Details

Release files / bf16-1.0.5-py3-none-any.whl

Download URL bf16-1.0.5-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09cf6293387cfc10fc20adf87b46c35390c9cba2d73a0fb65c24abae21295cf3
BLAKE2b-256 checksum
How to use checksums
f8ff404d2739d8d481eb9fc5e45f57ee7938e53bb3dd7097050fbb4a709a27cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.5 This release

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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