J
John Bentley
John Bentley writes at this level:
If we think about our savings accounts then division never comes in (as far as
I can see). We deposit and withdraw exact amounts most of the time. Occasionaly
we get an interest payment. Unless the bank is cruel to its developers the
interest figure will be able to be exactly represented by a computer, something
like 4.1% as opposed to 4 1/3 %
125.78 * ' Initial Balance
04.1%
-------
5.15698 +
125.78
--------
130.93698 ' Final Balance
(If you then apply an interest payment to this then the number of decimal places
will grow.)
What, exactly is your entitlement? 130.93, 130.94, 130.9367, 130.93698?
I speculate that there is some IEEE standard for financial transactions which
says that currency amounts shall be stored to 4 decimal places, rounded
according to "banker's rounding" (which is toward the even number). So, for
example, if an interest payment yields an intermediate balance of 157.34865 this
gets *stored* in your account as 157.3486. The 0.0086 is kept there for future
rounding operations. However if you closed your account with 157.3486 in it you
will be actually handed 157.35. If you closed your account on a day with
157.3428 in it, you will get back 157.34.
Is there a standard for financial transactions which specifies a maximum number
of decimal places to which you should store currency amounts?
--
If we think about our savings accounts then division never comes in (as far as
I can see). We deposit and withdraw exact amounts most of the time. Occasionaly
we get an interest payment. Unless the bank is cruel to its developers the
interest figure will be able to be exactly represented by a computer, something
like 4.1% as opposed to 4 1/3 %
125.78 * ' Initial Balance
04.1%
-------
5.15698 +
125.78
--------
130.93698 ' Final Balance
(If you then apply an interest payment to this then the number of decimal places
will grow.)
What, exactly is your entitlement? 130.93, 130.94, 130.9367, 130.93698?
I speculate that there is some IEEE standard for financial transactions which
says that currency amounts shall be stored to 4 decimal places, rounded
according to "banker's rounding" (which is toward the even number). So, for
example, if an interest payment yields an intermediate balance of 157.34865 this
gets *stored* in your account as 157.3486. The 0.0086 is kept there for future
rounding operations. However if you closed your account with 157.3486 in it you
will be actually handed 157.35. If you closed your account on a day with
157.3428 in it, you will get back 157.34.
Is there a standard for financial transactions which specifies a maximum number
of decimal places to which you should store currency amounts?
--