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.0.0.tar.gz
(1.8 kB
view hashes)
Built Distributions
Close
Hashes for PyClassicRound-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a79f5754cfc349fa1a464529ebab2eb0535f3afb4ee70b054b6e7bf29f97d1f |
|
MD5 | 44c00db10d49800768c3de9955d7af6d |
|
BLAKE2b-256 | 07861949da4b7fc0aa4c6dcc1e3822fc32bef8e88de7683c2b04f19aa52543d4 |
Close
Hashes for PyClassicRound-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8ad8e97d84998b0a5484358dca656b05b6234e0c3601a6dd1f69a686ae9d5dc |
|
MD5 | 1fc2acd7377828fd1f9fbf043aadff96 |
|
BLAKE2b-256 | 4085c8b2902d6a7231df9cd31d549c7652f7aa5e37a3063b206036e60ffeb60c |