give values and wanted ratios, the tool balances it for you
Project description
Ratiobalance
I needed something to balance numbers to certain percentages, but only with addition. The math was not convenient in a calculator, so I made this program to do it for me. It's neat with some good information, showing the differences too.
$ ratiobalance 512.12 522 12 -r 53 45 2
=====================================Values=====================================
1: 512.12 => 48.95%
2: 522.00 => 49.90%
3: 12.00 => 1.15%
====================================Analysis====================================
total : 1046.12
optimizing with : 2 (522.0 => 49.90%)
new 1% : 11.60
new 1% * rat(2) : 522.0 ≈ 522.0
=====================================Result=====================================
1: 614.8000 ( +102.68) => 53.00%
2: 522.0000 ( +0.00) => 45.00%
3: 23.2000 ( +11.20) => 2.00%
================================Result Analysis=================================
factor for added value : 1.00
new total : 1160.00
total diff : 113.88
================================================================================
For cases where you don't want to keep the ratio but rather changed the added
amount, you can use the -f option to multiply the amount that gets actually
added by some factor. So if the total diff shows 113.88 as in the example, but
you want to remain under 100 changed, try around with the -f option until you
have reached a satisfactory result.
Please note that using the -f option may make the ratio imperfect again and
that numbers are implicitly rounded to two comma values.
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 ratiobalance-0.2.4.tar.gz.
File metadata
- Download URL: ratiobalance-0.2.4.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.5 Linux/6.12.90+deb13.1-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc802e3e03b06c2eab2123f682b60bc1d1e6a6765777309262830e863cfb55eb
|
|
| MD5 |
22a4829289d8fc454c285c111e148cb9
|
|
| BLAKE2b-256 |
65a73240e933e3207c53f466df015109b8ff6dcf9fae989ed45e75014ace938b
|
File details
Details for the file ratiobalance-0.2.4-py3-none-any.whl.
File metadata
- Download URL: ratiobalance-0.2.4-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.5 Linux/6.12.90+deb13.1-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
371af93ad739863d78fa567f44a633a4bb79d0f918bcc55d88fb4d48a2b944a4
|
|
| MD5 |
4256be31b49e76b3d0d7ab1a637507f0
|
|
| BLAKE2b-256 |
98605fcc1a13a480882ba6b7e1ed69a1353351ed02836b52d4b2dac4b91bf0f9
|