--- id: rounders version: "0.2.0" license: unclear license_treatment: permissive maintenance: active --- # rounders — round-function equivalents with different rounding-modes License: permissive · Maintenance: active · Downloads: 149.0K/mo ## 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 above — 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 pip install rounders uv add rounders poetry add rounders ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 149.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags rounding modes, significant figures rounding, banker's rounding alternative, decimal rounding control, round away from zero, custom rounding functions, ties to even rounding, numeric-precision, rounding-modes [View on SkillFed](https://skillfed.io/packages/rounders) · [View on PyPI](https://pypi.org/project/rounders/)