No project description provided
Project description
betterRound - A simple, small Python package for better rounding.
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;
- Up/Ceiling - Always round up.
- Down/Floor - Always round down.
- 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
Numbers like 00000 that become 0 as a python integer won't work, even if opt="up", as there wont be enough digits.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file betterround-1.10.tar.gz.
File metadata
- Download URL: betterround-1.10.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56e6da2acadca8ff183ef665a065fa96885a42ce57ce509cd91281c7723b9758
|
|
| MD5 |
fe7c75c1ab7cab923dcd718ee6ab04c1
|
|
| BLAKE2b-256 |
3dbbb522fe971ec93fe435d5cedbbb6fbb3fc4c521d65876546ae6d1c21278a4
|
File details
Details for the file betterround-1.10-py3-none-any.whl.
File metadata
- Download URL: betterround-1.10-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c26b8e30ab217170b3f48deea736debdec781bd3e7eefe7fadf447d0070b3401
|
|
| MD5 |
10f9ac42456329556df12fd97461ced5
|
|
| BLAKE2b-256 |
413ea35b431cde7f1dce65c090b9c41f3c1d4dbf36c79e2f98457c5d4b0e4be1
|