rounders
round-function equivalents with different rounding-modes
What it is and what it does
Rounders extends Python's built-in `round` function to support thirteen different rounding modes beyond the default Banker's rounding (TIES_TO_EVEN). It provides both mode-specific functions (like `round_ties_to_away` or `ceil`) and a general `round` function that accepts a `mode` parameter. The package also adds `round_to_figures` for rounding to significant figures rather than decimal places, which is useful in scientific and financial contexts where relative precision matters more than absolute decimal precision.
The package supports rounding Decimal, Fraction, and float types. It includes six to-nearest modes (handling ties differently), six directed modes (always rounding in one direction), and one specialized mode for avoiding double-rounding errors. Common use cases include matching JavaScript's `Math.round` behavior, implementing school-taught rounding (ties away from zero), or selecting IEEE 754 compliant rounding for numerical computing.
Use it for:
- Financial calculations where you need to round ties away from zero instead of to even, matching common business expectations.
- Scientific data processing where rounding to significant figures is more meaningful than rounding to a fixed decimal place.
- Porting code from JavaScript or other languages that use different default rounding modes.
- Numerical algorithms that require specific rounding modes to avoid double-rounding errors (TO_ODD mode).
- Educational or testing scenarios where you need to demonstrate or verify different rounding behaviors.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides drop-in replacements for Python's built-in `round` function with thirteen different rounding modes, plus functions for rounding to significant figures instead of decimal places.
Yes. The package has zero dependencies, low install friction, active maintenance, permissive licensing, and fills a genuine gap in Python's standard library. It's useful for anyone working with financial data, scientific calculations, or code that must match specific rounding semantics. No known vulnerabilities.
Install
rounders on PyPI
pip
pip install roundersuv
uv add rounderspoetry
poetry add roundersInstalling rounders
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of June 2024, though infrequently updated (last commit 796 days ago). Repository is not archived.
License in practice
Licensed under Apache 2.0 (permissive). You can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
from rounders import round, TIES_TO_AWAY
# Default Banker's rounding
result = round(2.5)
# Round ties away from zero
result = round(2.5, mode=TIES_TO_AWAY)
# Round to significant figures
from rounders import round_to_figures
result = round_to_figures(1.234567, 3)
Requires Python 3.8 or later.
Verify before relying
- Whether the package has a published test suite or documented test coverage.
- Performance characteristics when rounding very large numbers or high-precision decimals.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 796 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 148,951/month — #11,011 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rounders-0.2.0-py3-none-any.whl
Keywords: round, rounding, significant figures, decimal places, rounding mode
Tags
More Mathematics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
kiwisolverkiwisolver is a Python binding to a fast C++…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
onnxruntimeonnxruntime loads and executes Open Neural…
permissive · top 1,000 on PyPI
sigfigRounds numbers by significant figures, decimal…
permissive · top 5,000 on PyPI
py-moneyRepresents monetary amounts with currency-aware…
permissive · top 15,000 on PyPI
py-moneyedProvides Money and Currency classes for…
permissive · top 5,000 on PyPI
prefixedPrefixed provides a Float subclass that formats…
copyleft · top 5,000 on PyPI
py-expression-evalParses and evaluates mathematical expressions…
permissive · top 15,000 on PyPI
hightimeHightime provides drop-in replacements for…
permissive · top 15,000 on PyPI
ml-dtypesml_dtypes provides NumPy-compatible data types…
permissive · top 1,000 on PyPI