Skip to main content

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.

Metadata

Release files for ratiobalance 0.2.4

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

Source distribution (sdist)

Source distribution for ratiobalance 0.2.4
File Size Uploaded Provenance Actions
ratiobalance-0.2.4.tar.gz 3.3 kB Without provenance Details for ratiobalance-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 7.6 kB

Release files / ratiobalance-0.2.4.tar.gz

Download URL ratiobalance-0.2.4.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fc802e3e03b06c2eab2123f682b60bc1d1e6a6765777309262830e863cfb55eb
BLAKE2b-256 checksum
How to use checksums
65a73240e933e3207c53f466df015109b8ff6dcf9fae989ed45e75014ace938b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.13.5 Linux/6.12.90+deb13.1-amd64

Release files / ratiobalance-0.2.4-py3-none-any.whl

Download URL ratiobalance-0.2.4-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
371af93ad739863d78fa567f44a633a4bb79d0f918bcc55d88fb4d48a2b944a4
BLAKE2b-256 checksum
How to use checksums
98605fcc1a13a480882ba6b7e1ed69a1353351ed02836b52d4b2dac4b91bf0f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.13.5 Linux/6.12.90+deb13.1-amd64

Security for ratiobalance 0.2.4

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.

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files No provenance

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