Skip to main content

The package contains mathematical rounding function

Reason this release was yanked:

Wrong dependencies

Project description

Mathematical rounding in Python

This package has one purpose: fast mathematical rounding of numbers.

Installation

Use the following command to install the package:

pip install math-rounding

The package can use numba to increase speed of the calculations. If you want to install it with numba, you can use the following command:

pip install math-rounding[numba]

or just install numba separately.

Usage

The main function of the package math_rounding has the following signature:

def math_rounding(n: Number, p: int = 0) -> float:
    ...

where:

  • n is the number to round;
  • p is integer number that specifies the position to which rounding will be performed.

p could be a positive number or a negative number. It represents the position in the number from the dot:

  • when it's equal to 0 (default), the rounding will be performed to integer;
  • when it's positive, it represents the position in fractional part of the number;
  • when it's negative, it represents the position in integer part of the number.

Example

from math_rounding import math_rounding

print(math_rounding(0.5))      # 1.0
print(math_rounding(-0.5))     # -1.0
print(math_rounding(1.1))      # 1.0
print(math_rounding(0.05, 1))  # 0.1
print(math_rounding(5, -1))    # 10.0
print(math_rounding(15, -1))   # 20.0

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

math_rounding-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

math_rounding-1.0.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file math_rounding-1.0.0.tar.gz.

File metadata

  • Download URL: math_rounding-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for math_rounding-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3508cc388b132184c05c9af43df15672ca8d629aceb52c1bdf8ba8b7df1f0582
MD5 81668e0c7919f0c617c2b970a4dee4b2
BLAKE2b-256 17f6918e6b1103f80cb64af601229ff56c5281fc53c13ab39c76551c98f696f1

See more details on using hashes here.

File details

Details for the file math_rounding-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: math_rounding-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for math_rounding-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8505f996506633d92a763b75a1de88df74f406dd7f688b389366212a1e88baa9
MD5 c16f14b3c55d41bc5029da7c45584604
BLAKE2b-256 53f8172c269b21185eaba1903e86e100275f9504bff68f360d02092c08013a51

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