2013 Archives by date, by thread · List index

# Re: [libreoffice-users] Re: Visible currency rounding

At 22:30 19/07/2013 -0400, Mark LaPierre wrote:
On 07/19/2013 07:26 PM, Todor Takov wrote:
I needed to implement the so called Bankers' Rounding Function, which would round with respect to the 4/5 rule.
[...]

Just one point I would like to make. If you are working with money be sure that the total of the rounded amounts adds up to match the original amount.

Example:

\$5.39 divided among several accounts.

10.5% to Acct A = 0.56595  => \$0.57
13.5% to Acct B = 0.72765  => \$0.73
17%   to Acct C = 0.9163   => \$0.92
59%   to Acct D = 3.1801   => \$3.18
=====
Total = \$5.40

Any summing error needs to be accounted for if you ever want your accounts to balance.

I'm not sure you appreciated the significance of the questioner's "Bankers' Rounding Function". You've given an excellent example of how this works. Using banker's rounding instead of "primary school mathematics teachers's rounding" on your figures, your first dividend, 0.56595, would round to 0.56, not 0.57 (with no change to the other figures), and the total of the rounded values would be the required \$5.39.

Brian Barker

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

### Context

• Re: [libreoffice-users] Re: Visible currency rounding · Brian Barker