Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rohitxsh/pyclassicround
Current python 3's round function uses Banker's rounding, this package will help you to round off numbers the classical way.
https://github.com/rohitxsh/pyclassicround
python python3 round rounding
Last synced: 15 days ago
JSON representation
Current python 3's round function uses Banker's rounding, this package will help you to round off numbers the classical way.
- Host: GitHub
- URL: https://github.com/rohitxsh/pyclassicround
- Owner: rohitxsh
- License: mit
- Created: 2020-08-01T21:51:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-25T18:30:49.000Z (about 4 years ago)
- Last Synced: 2024-10-18T13:16:39.535Z (2 months ago)
- Topics: python, python3, round, rounding
- Language: Python
- Homepage: https://pypi.org/project/PyClassicRound/
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
[![Downloads](https://pepy.tech/badge/pyclassicround)](https://pepy.tech/project/pyclassicround)
### Installation
PyClassicRound has no dependencies.
```sh
> pip install PyClassicRound
```### Usage (example)
```sh
> from PyClassicRound import classic_round> classic_round(2.55, 1) #outputs 2.6 whereas python 3's round() outputs 2.5
```
#### OR```sh
> from PyClassicRound import classic_round as cround> cround(2.55, 1) #outputs 2.6 whereas python 3's round() outputs 2.5
```### Parameters
- Number that needs to be rounded off
- Upto how many decimal places (__optional__) (**defaults to 2 decimal points** (Hundredths Place))Input parameters can be in any format i.e. integer, float, string etc.
Output will be:
- integer: if decimal point is 0
- on successful operation: float
- None: if the input value cannot be resolved / rounded off for ex. strings -> ("", " ", "abc")### License
MIT