I'm currently working on an app that divides up commissions between users. I have a table of percentages, which determines how much each user gets. For example, Let's say someone makes a $100 sale. He gets 80%, another user gets 15%, and another gets 5%. In this example the math is easy, but the tables are much more complicated than that.
I need a way to exactly divide up an amount by percentages. The sum of all pieces must equal the original sale amount. I think my problem lies in the floating point dollar amounts I am winding up with, and some sort of rounding taking place. Any ideas?
Dividing up money?
Moderator: General Moderators