Skip to main content

betterRound - A simple, small Python package for better rounding.

version: 1.0 python version: 3.14 - 3.16

Be honest, the current round() function sucks. Only rounding to units? That's why I have created betterRound. Here's how it works.

Setup

Make sure that betterRound is installed (run pip install betterRound in your terminal), then add from betterRound import *. Now you can use betterRound in your project!

Usage

betterRound only includes one function - betterRound(). betterRound() takes 3 inputs, betterRound(num, sf = 1, opt = "round"). Num is the number to round. Any number should work. Negatives are kinda wierd as I just thought of it now and put in a quick fix, it should be fully fixed later. Sf stands for Significant Figure, and by default is 1, which means the first digit will be the only one that stays the same. For decimals, you dont need to increment your sf, as my code will do it for you, so if you wanted to round everything after the 4 in 329.4826, you would put 4, as it is the fourth number. Finally, opt is the option argument. It is converted into lowercase before used, so don't worry about that. There are 3 options;

  1. Up/Ceiling - Always round up.
  2. Down/Floor - Always round down.
  3. Round/Anything else - If the number after the last sf is over 5, round up, otherwise round down.

Examples

print(betterRound(928346, 4))
>> 928300

print(betterRound(111111, 1, up))
>> 200000

Other Info

  1. The version system works as the fist number being the actual script, while the second being the readme, as I couldn't figure out the syntax for the life of me for aa while.
  2. Numbers like 00000 that become 0 as a python integer won't work, even if opt="up", as there wont be enough digits.

Metadata

Release files for betterRound 1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for betterRound 1.13
File Size Uploaded Provenance Actions
betterround-1.13.tar.gz 2.8 kB Without provenance Details for betterround-1.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for betterRound 1.13
File Interpreter ABI Platform Actions
betterround-1.13-py3-none-any.whl Python 3 none any Details for betterround-1.13-py3-none-any.whl

Total release size: 6.0 kB

Release files / betterround-1.13.tar.gz

Download URL betterround-1.13.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
30bdc5b2b84e9af6c7eed864480d1c8abe146dd9b5b34b8ef83e904acf0f8ffd
BLAKE2b-256 checksum
How to use checksums
9b7481a50c066e3f6a50e235f75ba06ba6a791e979053ff3b49b42cd7f5aef9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / betterround-1.13-py3-none-any.whl

Download URL betterround-1.13-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0603fbfd3f6b95575956f93b18c7a7f0c6206ce44a6c48230bc12b905e16e87
BLAKE2b-256 checksum
How to use checksums
5d103b736a1defdea732c54358fe704d50f5d26514787ab4abc6f6cd49139ecf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for betterRound 1.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page