sigfig
Python library for rounding numbers (with expected results)
What it is and what it does
sigfig is a Python library that fixes the unintuitive behavior of Python's built-in round() function by providing mathematically correct rounding based on significant figures, decimal places, or measurement uncertainty. It accepts numbers in multiple formats (int, float, string) and returns rounded results as strings or formatted output.
The package is designed for scientific, financial, and educational contexts where rounding precision matters. It supports several output formats including Drake notation and uncertainty representation, making it useful for publishing results, displaying measurements with error bounds, or ensuring consistent numerical behavior across calculations where standard Python rounding would give unexpected results.
Use it for:
- Round measurement data with associated uncertainty for scientific publications or lab reports.
- Format financial figures to significant digits for regulatory or presentation purposes.
- Ensure consistent rounding behavior in educational software or numerical computing workflows.
- Convert numeric results to publication-ready strings with appropriate precision notation.
- Handle rounding in physics or chemistry calculations where significant figures are critical.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Rounds numbers by significant figures, decimal places, or uncertainty, and formats them in multiple scientific and publication styles with results that match expected mathematical behavior.
Yes, if you need reliable significant-figure or uncertainty-based rounding. The package is stable (Production/Stable status), permissively licensed, has no known vulnerabilities, and carries low install friction. The aging maintenance status (last release 522 days ago) is not a blocker for a mature rounding library, but verify that its behavior matches your specific rounding requirements before adopting it in new projects.
Install
sigfig on PyPI
pip
pip install sigfiguv
uv add sigfigpoetry
poetry add sigfigInstalling sigfig
Before you install
Low install friction with a single lightweight dependency (sortedcontainers). Last release was 522 days ago; the repository is not archived and receives occasional updates, though the aging maintenance status suggests infrequent active development.
License in practice
MIT License permits commercial and private use, modification, and distribution with minimal restrictions, making it suitable for most projects without licensing concerns.
Quickstart
pip install sigfig
from sigfig import round
round(3.14159, sigfigs=2) # Returns '3.1'
round(0.25, decimals=1) # Returns '0.3'
Requires Python 3.8 or later (supports up to 3.12).
Verify before relying
- Whether the package handles edge cases like very large numbers or extreme precision requests gracefully.
- Performance characteristics when rounding large datasets or in tight loops.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — sortedcontainers |
| Maintenance | aging — 522 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 824,182/month — #4,963 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sigfig-1.3.19-py3-none-any.whl
Keywords: round, rounding, significant figures, significant digits, sigfigs, sigdigs, decimals, uncertainty, uncertainties, numeric, numerical, number, numbers, data, format, style, publication
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
roundersProvides drop-in replacements for Python's…
permissive · top 15,000 on PyPI
uncertaintiesPerforms arithmetic and mathematical operations…
permissive · top 5,000 on PyPI
py-moneyRepresents monetary amounts with currency-aware…
permissive · top 15,000 on PyPI
prefixedPrefixed provides a Float subclass that formats…
copyleft · top 5,000 on PyPI
ff3Implements NIST FF3 and FF3-1 format-preserving…
permissive · top 15,000 on PyPI
text2digitsConverts written-out number words in text to…
permissive · top 15,000 on PyPI
luhnGenerates and verifies Luhn check digits for…
permissive · top 15,000 on PyPI
word2numberConverts written-out number words (like "twenty…
permissive · top 5,000 on PyPI
matplotlibmatplotlib creates static, animated, and…
permissive · top 1,000 on PyPI