You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In both cases it would be preferable if the values to come out were GBP 62.50 and 37.50, regardless of the order.
If the allocate method were to take floats (or perhaps preferably rational numbers) it could implement a test to see if the allocation yields a remainder. If so, convert to integer.
The text was updated successfully, but these errors were encountered:
Hi, the main issue is that your floats are casted to int, so you're actually passing 37 and 62, respectively. PHP does not even complain in this case, which is a pity IMO. Now because of the spread of the remainder on the first monies, you get a different result when the parameters are passed in a different order, this is expected.
Now if you want consistent results not depending on the order of the ratios, you can use allocateWithRemainder():
Consider
In both cases it would be preferable if the values to come out were GBP 62.50 and 37.50, regardless of the order.
If the allocate method were to take floats (or perhaps preferably rational numbers) it could implement a test to see if the allocation yields a remainder. If so, convert to integer.
The text was updated successfully, but these errors were encountered: