We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3665ef7 commit b0be3ceCopy full SHA for b0be3ce
1 file changed
lib/money.ex
@@ -1998,8 +1998,8 @@ defmodule Money do
1998
subtract and round that portion's value from the current remaining amount.
1999
2000
eg. with [2, 1] as portions and $1 to spread, we calculate that 2/3 of the amount
2001
- should remain after `1` receives its portion, so we subtract an unrounded Money amount of
2002
- 0.666666, and we round it (to 0.33). Then $1.00 - 0.33 is the new remaining amount.
+ should remain after `1` receives its portion, so we subtract the unrounded Money amount of
+ 0.666666, and we round the share to $0.33. Then $1.00 - 0.33 is the new remaining amount.
2003
This approach avoids numerical instability by using the expected remaining amount,
2004
rather than summing up values as they are doled out.
2005
0 commit comments