skillfed

sigfig

Python library for rounding numbers (with expected results)

sigfig v1.3.19 824.2K downloads/30d#4,963 on PyPI26
Permissive license MIT License AGING released

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 sigfig

uv

uv add sigfig

poetry

poetry add sigfig

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Financial and Insurance IndustryIntended Audience :: Healthcare IndustryIntended Audience :: ManufacturingIntended Audience :: Other AudienceIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: EducationTopic :: Education :: Computer Aided Instruction (CAI)Topic :: Office/Business :: FinancialTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Information AnalysisTopic :: Scientific/Engineering :: MathematicsTopic :: Scientific/Engineering :: PhysicsTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities

Tags

round by significant figuresscientific roundinguncertainty roundingnumber formatting scientificsigfigs roundingdecimal rounding with precisionpublication number format
numeric-precisionscientific-computing

More Software Development packages