Skip to main content

Current python 3's round function uses Banker's rounding, this package will help you to round off 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.5

OR

> 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

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-2.2.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyClassicRound-2.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file PyClassicRound-2.2.tar.gz.

File metadata

  • Download URL: PyClassicRound-2.2.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for PyClassicRound-2.2.tar.gz
Algorithm Hash digest
SHA256 764c55bebe97f08bd2255b08d47c32724ad7d82f8184eea10c04bcd4b7b74570
MD5 1112c79afb229a5010b7c10f32e9698f
BLAKE2b-256 37c832fcf949b88e15b6fb47e8bc4914cb4da9864818cc58855961413b6cb7a5

See more details on using hashes here.

File details

Details for the file PyClassicRound-2.2-py3-none-any.whl.

File metadata

  • Download URL: PyClassicRound-2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for PyClassicRound-2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 663c7d76d4e15b519735b16943dfc6a15e5b7953ac86d98ae893b0f5594e0891
MD5 29d4094e1cd5dd0c2ff5fe1b4b09e1b2
BLAKE2b-256 8eb1dcf15f03c207abbf2bedaabea1181449b2c1f0ab7855a67d155bafa0873e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page