Round half away from zero.
pip install round2
Since python's default round function uses 'bankers rounding', I made this small module that uses 'commercial rounding' instead. This means half is rounded up for positive numbers and down for negative numbers:
>>> from round2 import round2
>>> round2(1.5)
2
>>> round2(2.5)
3
>>> round2(-1.5)
-2
>>> round2(-2.5)
-3
>>> round2(2.5, decimals=1)
2.5
If decimals=0 (default), returns an int, otherwise a float, just like Python’s round function.
Implemented in Cython with type hinting in Python.
Metadata
Release files for round2 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| round2-0.0.4.tar.gz | 24.0 kB | Without provenance | Details for round2-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| round2-0.0.4-cp39-cp39-win_amd64.whl | CPython 3.9 | CPython 3.9 | Windows x86-64 | Details for round2-0.0.4-cp39-cp39-win_amd64.whl |
Total release size: 38.4 kB
Release files / round2-0.0.4.tar.gz
| Download URL | round2-0.0.4.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b5f43861ad31db9a2a26dfb50b8591ea5524984e6f58fc59c2a4e5c7dde9a2a
|
|
BLAKE2b-256 checksum How to use checksums |
786d383882b83f3224168c69dc54981d83ac78db17548bd197c639a4969d23a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / round2-0.0.4-cp39-cp39-win_amd64.whl
| Download URL | round2-0.0.4-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 14.4 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f509c5fc5a7355c2ec6906b9babc6ae9fcc240fb6a25e162c73090e3146a0c6e
|
|
BLAKE2b-256 checksum How to use checksums |
d03348af2bd0ed8dc9d90256a2fbe2b5aa042e6ade8ebfc7fb015c376a0018e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for round2 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.