• Currency storage format

    From TimS@21:1/5 to All on Tue Dec 13 18:26:13 2022
    Anyone know how banks store the values of the amount we have in our accounts?
    I mean in the sense of internal storage and calculation. I've seen it stated that in the (presumably) US, they have by law to store amounts to 100th of a cent, sort of implying they do fixed-point decimal arithmetic on your account balance as it changes. Anyone know whether that just them or is that
    worldwide. Do we do anything different?

    --
    Tim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joerg Lorenz@21:1/5 to All on Tue Dec 13 21:12:42 2022
    Am 13.12.22 um 19:26 schrieb TimS:
    Anyone know how banks store the values of the amount we have in our accounts? I mean in the sense of internal storage and calculation. I've seen it stated that in the (presumably) US, they have by law to store amounts to 100th of a cent, sort of implying they do fixed-point decimal arithmetic on your account balance as it changes. Anyone know whether that just them or is that worldwide. Do we do anything different?

    Where is the connection to Macs?
    Are you trolling once more?

    --
    Gutta cavat lapidem (Ovid)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bruce Horrocks@21:1/5 to TimS on Fri Dec 16 17:14:02 2022
    On 13/12/2022 18:26, TimS wrote:
    Anyone know how banks store the values of the amount we have in our accounts? I mean in the sense of internal storage and calculation. I've seen it stated that in the (presumably) US, they have by law to store amounts to 100th of a cent, sort of implying they do fixed-point decimal arithmetic on your account balance as it changes. Anyone know whether that just them or is that worldwide. Do we do anything different?


    I can't imagine why they would need or want to store to 100th of a cent.
    100th of a dollar is more likely.

    But typically financial amounts are held in decimal (not binary) with
    fixed 2 decimal places.

    I heard an amusing story from someone hired to review a bank's COBOL
    apps for a Euro compliance project back in the 1990s who discovered that
    all the account calculation routines (adding, withdrawing funds,
    displaying amounts etc) had been centralised into a few key subroutines.
    Not just because this was good design but because it was the the outcome
    of a previous round of work to make the systems support decimalisation
    and the code was still in use 20+ years later. (And is probably still in
    use now.)

    --
    Bruce Horrocks
    Surrey, England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John Hill@21:1/5 to Bruce Horrocks on Fri Dec 16 17:23:24 2022
    Bruce Horrocks <07.013@scorecrow.com> wrote:
    On 13/12/2022 18:26, TimS wrote:
    Anyone know how banks store the values of the amount we have in our accounts?
    I mean in the sense of internal storage and calculation. I've seen it stated >> that in the (presumably) US, they have by law to store amounts to 100th of a >> cent, sort of implying they do fixed-point decimal arithmetic on your account
    balance as it changes. Anyone know whether that just them or is that
    worldwide. Do we do anything different?


    I can't imagine why they would need or want to store to 100th of a cent. 100th of a dollar is more likely.

    But typically financial amounts are held in decimal (not binary) with
    fixed 2 decimal places.

    I heard an amusing story from someone hired to review a bank's COBOL
    apps for a Euro compliance project back in the 1990s who discovered that
    all the account calculation routines (adding, withdrawing funds,
    displaying amounts etc) had been centralised into a few key subroutines.
    Not just because this was good design but because it was the the outcome
    of a previous round of work to make the systems support decimalisation
    and the code was still in use 20+ years later. (And is probably still in
    use now.)


    Well, if it ain't broke, don't fix it!

    1/100 cent seems reasonable to me. Rounding errors can mount up when you
    are adding a large number of items.

    I seem to recollect that there was a scandal because a bank employee had
    coded the system to round down all amounts add divert the fractions to his private account. Maybe an urban myth.

    John.

    --
    Today is the tomorrow we worried about yesterday,and all is well.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bruce Horrocks@21:1/5 to John Hill on Fri Dec 16 17:44:49 2022
    On 16/12/2022 17:23, John Hill wrote:
    Bruce Horrocks <07.013@scorecrow.com> wrote:
    On 13/12/2022 18:26, TimS wrote:
    Anyone know how banks store the values of the amount we have in our accounts?
    I mean in the sense of internal storage and calculation. I've seen it stated
    that in the (presumably) US, they have by law to store amounts to 100th of a
    cent, sort of implying they do fixed-point decimal arithmetic on your account
    balance as it changes. Anyone know whether that just them or is that
    worldwide. Do we do anything different?


    I can't imagine why they would need or want to store to 100th of a cent.
    100th of a dollar is more likely.

    But typically financial amounts are held in decimal (not binary) with
    fixed 2 decimal places.

    I heard an amusing story from someone hired to review a bank's COBOL
    apps for a Euro compliance project back in the 1990s who discovered that
    all the account calculation routines (adding, withdrawing funds,
    displaying amounts etc) had been centralised into a few key subroutines.
    Not just because this was good design but because it was the the outcome
    of a previous round of work to make the systems support decimalisation
    and the code was still in use 20+ years later. (And is probably still in
    use now.)


    Well, if it ain't broke, don't fix it!

    1/100 cent seems reasonable to me. Rounding errors can mount up when you
    are adding a large number of items.

    I seem to recollect that there was a scandal because a bank employee had coded the system to round down all amounts add divert the fractions to his private account. Maybe an urban myth.

    Possibly a myth - I've heard several versions of it. Rounding errors are
    bound to occur, especially with things like loans, but I don't believe
    they are allowed to accumulate in the actual accounts.

    They can be accumulated elsewhere, of course, and dealt with according
    to the rules relating to the loan, or to the bank's general rules. But
    they should be dealt with by an explicit rule, not left to quirks of the underlying storage format.

    --
    Bruce Horrocks
    Surrey, England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From TimH@21:1/5 to John Hill on Fri Dec 16 21:09:02 2022
    On 16 Dec 2022 at 5:23:24 pm GMT, "John Hill" <yclept@outlook.com> wrote:

    I seem to recollect that there was a scandal because a bank employee had coded the system to round down all amounts add divert the fractions to his private account. Maybe an urban myth.

    Wasn't that a plotline in a Superman film? Lex Luthor doing exactly that?
    --
    TimH
    pull tooth to reply by email

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Hewitt@21:1/5 to TimH on Sat Dec 17 08:04:56 2022
    On 16/12/2022 21:09, TimH wrote:
    On 16 Dec 2022 at 5:23:24 pm GMT, "John Hill" <yclept@outlook.com> wrote:

    I seem to recollect that there was a scandal because a bank employee had
    coded the system to round down all amounts add divert the fractions to his >> private account. Maybe an urban myth.

    Wasn't that a plotline in a Superman film? Lex Luthor doing exactly that?

    Yes, actually Richard Pryor's character wasn't it.

    --
    Andy H

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From RJH@21:1/5 to TimH on Sat Dec 17 08:09:04 2022
    On 16 Dec 2022 at 21:09:02 GMT, TimH wrote:

    On 16 Dec 2022 at 5:23:24 pm GMT, "John Hill" <yclept@outlook.com> wrote:

    I seem to recollect that there was a scandal because a bank employee had
    coded the system to round down all amounts add divert the fractions to his >> private account. Maybe an urban myth.

    Wasn't that a plotline in a Superman film? Lex Luthor doing exactly that?

    And Office Space, good for a puerile chuckle :-)

    --
    Cheers, Rob, Sheffield UK

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From TimS@21:1/5 to Bruce Horrocks on Sat Dec 17 09:16:10 2022
    On 16 Dec 2022 at 17:14:02 GMT, "Bruce Horrocks" <07.013@scorecrow.com> wrote:

    On 13/12/2022 18:26, TimS wrote:
    Anyone know how banks store the values of the amount we have in our accounts?
    I mean in the sense of internal storage and calculation. I've seen it stated >> that in the (presumably) US, they have by law to store amounts to 100th of a >> cent, sort of implying they do fixed-point decimal arithmetic on your account
    balance as it changes. Anyone know whether that just them or is that
    worldwide. Do we do anything different?

    I can't imagine why they would need or want to store to 100th of a cent. 100th of a dollar is more likely.

    This chap (on a forum for a well-known database) asserted quite firmly that this was the law, never mind whether it's needed or not. Presumably where he
    is and that was presumably the US. I became curious to know whether that's universal (both the 100th of a cent business, and the law) or not.

    --
    Tim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bruce Horrocks@21:1/5 to TimS on Mon Dec 19 23:06:43 2022
    On 17/12/2022 09:16, TimS wrote:
    On 16 Dec 2022 at 17:14:02 GMT, "Bruce Horrocks" <07.013@scorecrow.com> wrote:

    On 13/12/2022 18:26, TimS wrote:
    Anyone know how banks store the values of the amount we have in our accounts?
    I mean in the sense of internal storage and calculation. I've seen it stated
    that in the (presumably) US, they have by law to store amounts to 100th of a
    cent, sort of implying they do fixed-point decimal arithmetic on your account
    balance as it changes. Anyone know whether that just them or is that
    worldwide. Do we do anything different?

    I can't imagine why they would need or want to store to 100th of a cent.
    100th of a dollar is more likely.

    This chap (on a forum for a well-known database) asserted quite firmly that this was the law, never mind whether it's needed or not. Presumably where he is and that was presumably the US. I became curious to know whether that's universal (both the 100th of a cent business, and the law) or not.


    I'd be interested in seeing a reference to the law in question if he's
    so certain.

    Microsoft SQL Server has a money type that stores monetary values to 4
    decimal places so maybe that's what he's thinking of.

    Oracle doesn't have an explicit money type and it's up to the DBA to
    choose what precision to adopt.

    DB2, just to be different again, does have a MONEY type but the DBA has
    to specify the precision and scale. (Precision equals the number of
    digits in total and scale is the number after the decimal point.) If not specified it defaults to 16 and 2.


    --
    Bruce Horrocks
    Surrey, England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)