The `rounders` package extends Python's built-in `round` function, providing a comprehensive collection of decimal rounding functionalities. It offers drop-in replacements for `round` that support thirteen different rounding modes beyond Python's default Banker's rounding, as well as functionality for rounding to a specified number of significant figures. The current version is 0.2.0, released on June 9, 2024, with an active development status.
pip install roundersVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates importing `round` with custom modes and `round_to_figures` for significant digit rounding. It highlights the behavior of `TIES_TO_AWAY` versus the default `TIES_TO_EVEN` (Banker's rounding) and `TO_MINUS`.
Be explicit with imports: `import builtins; from rounders import round as rounders_round` or always specify `mode` when using `rounders.round`.
Always explicitly specify the desired rounding mode using the `mode` argument (e.g., `round(2.5, mode=TIES_TO_AWAY)`) if you require a behavior different from Banker's Rounding.
Verify the correct library name and purpose: `rounders` for extended numerical rounding, `rounder` for rounding numbers within complex Python objects. Double-check import statements (`from rounders import ...` vs `import rounder as r`).
Ensure `from rounders import round` is correctly executed and that the `round` function being called is indeed from the `rounders` library. You can verify this by printing `round` (e.g., `print(round)` should show it pointing to the `rounders` module).
Use `round_to_figures` from the `rounders` library for rounding to significant figures: `from rounders import round_to_figures; round_to_figures(123.45, 3)`. If you need features from the `rounder` library, install and import it separately.
Import and explicitly use the `TIES_TO_AWAY` rounding mode from `rounders`: `from rounders import round, TIES_TO_AWAY; round(2.5, mode=TIES_TO_AWAY)` will yield `3` and `round(3.5, mode=TIES_TO_AWAY)` will yield `4`.
No dependency data recorded yet.