Current python 3's round function uses Banker's rounding, this package will help you to round numbers the classical way.
Project description
PyClassicRound
The current implementation of round() function in Python 3 uses Banker's rounding i.e integers are rounded to the nearest even integer, this package allows you to round off numbers the classical way.
Installation
PyClassicRound has no dependencies.
> pip install PyClassicRound
Usage (example)
> from PyClassicRound import classic_round
> classic_round(2.55, 1) #outputs 2.6 whereas python 3's round() outputs 2.6
Parameters
- Number that needs to be rounded off
- Upto which decimal places (optional) (defaults to 2 decimal points (Hundredths Place))
Input parameters can be in any format i.e. integer, float, string.
Output will be:
- integer -> if decimal points is 0
- otherwise float
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyClassicRound-1.2.tar.gz
(1.8 kB
view hashes)
Built Distribution
Close
Hashes for PyClassicRound-1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f05da6cd7366cced85b76c07f563b8464fcaff2bf63e69d90fa5ae68b0bb067 |
|
MD5 | 8ea9257dbfcf17d7a2316559ee406b4b |
|
BLAKE2b-256 | 513bda2e692a5dbe32b2b916c08be0d07d5d792d8aca5aedde0565dec9c3d2b2 |