Skip to main content

give values and wanted ratios, the tool balances it for you

Reason this release was yanked:

bad readme

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=====================================
01: 000000512.12                =>      48.95%
02: 000000522.00                =>      49.90%
03: 000000012.00                =>      1.15%
====================================Analysis====================================
total                           :       1046.12
optimizing                      :       02 (522.0 => 49.90%)
new 1%                          :       11.6
new 1% * rat(2)                 :       522.0 = 522.0
=====================================Result=====================================
01: 0000614.8000 (102.68)       =>      53.00%
02: 0000522.0000 (00.00)        =>      45.00%
03: 0000023.2000 (11.20)        =>      2.00%
================================Result Analysis=================================
factor for added                :       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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ratiobalance-0.2.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

ratiobalance-0.2.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file ratiobalance-0.2.1.tar.gz.

File metadata

  • Download URL: ratiobalance-0.2.1.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

Hashes for ratiobalance-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9b22aa6127fe05e2414f899a56c431e25b02848d55c1e8c46aac115c1b2e82e0
MD5 61c100dd7489fe55edd24dcc50f5c5be
BLAKE2b-256 885c2d4c3e8e5d0d27ce6751b2b9daba98989e25dae7aa5e00b86176b8041697

See more details on using hashes here.

File details

Details for the file ratiobalance-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ratiobalance-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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

Hashes for ratiobalance-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c17f6b9e5d046779808f94ddbec5c77c96428cfaec359aca5a1b477e03b0c194
MD5 a2135f95b8659a436d733bd1d3b3ed5c
BLAKE2b-256 17fe36d31d134e4b2ba46f3d44f91d378a0db94f4182dc353b73c9ecef5c2b50

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