Answer the question
In order to leave comments, you need to log in
How to round percentages correctly?
There is such a set of data that add up to 100% {'key_1': 10.55, 'key_2': 30.90, 'key_3': 58.55}. What methods are there to round numbers to integers but at the same time to get 100 as a result? Is there a package or something from the python standard library?
Answer the question
In order to leave comments, you need to log in
There is a so-called "accounting" rounding to the sum. For example, I will not take a percentage, how to divide 100 rubles between three employees: each receives 1/3 of the amount, the last balance is (33.33 + 33.33 + 33.34).
Additionally: not to be confused with "accounting" (or "banking") rounding to the nearest even number (the processor has a special register for switching rounding from mathematical to accounting).
Rounding Riddles .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question