Live data from Hacker News

64-bit bank balances ‘ought to be enough for anybody’?

tigerbeetle.com

221–230 of 372 posts

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#221

Earlier quoted context omitted.

Would IEEE decimal128 be sufficient (instead of arbitrary precision)? "Formally introduced in IEEE 754-2008, it is intended for applications where it is necessary to emulate decimal rounding exactly, such as financial and tax computations." https://en.wikipedia.org/wiki/Decimal128_floating-point_form...

Hypothetical solutions that do not exist are none of my concern. Did you know different countries and different currencies have different rounding rules, for example for tax-related calculations? Does "IEEE decimal128" support this? Unless you can get all countries on our planet to agree on a single standard, any solution that does not allow specifying rounding rules is pretty much useless (unless you want to impleme…

Well you did turn your hypothetical ignorance into practical one, I got calculator using it... actual physical object.

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#222
post #184

Earlier quoted context omitted.

A shocking number of people (edit: who implement billing related software) are unaware of how many decimal points of accuracy their local tax code requires to calculate vat or sales tax correctly. And those things are often specified in terms of arithmetic correctness. I had our CFO stand behind me while I talked him through every step of our VAT calculations once, because he was legally responsible if I made us roun…

in my experience, these are often written off as error. if the error is less than their hourly salary rate, it don't even worth mentioning. if it worth a day or two of salary, its nice to fix but never a priority

For it to be written off as error you need to know the discrepancy, which means you need to know what it's supposed to be. When e.g. calculating the VAT or sales tax you owe the government, if the rounding deviates from legal requirements then unless it's in their favour you can be in for a bad time.

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#223

Specialising in financial software, over the past 2 decades I have been fighting over this with countless people, teams and companies. For accounting you should only ever use arbitrary precision math library with ability to specify rounding rules. If your programming environment/language does not have one, it is unsuitable to be used for accounting, billing, invoicing, payments, etc. Having the underlying library is,…

"For accounting you should only ever use arbitrary precision math library"

I'm a bit surprised by this advice. I thought the common wisdom was to use a decimal type like BigDecimal in Java.

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#224
post #43

Earlier quoted context omitted.

I have a personal anecdote on this subject. A long time ago I worked at a bank and I had to calculate a large number of accounts regarding agricultural loans. These were state sponsored loans. When I finished my task (this was a Java job), I found that sometimes the results were off by $0.01. So I asked my boss how I should do the rounding, to which he replied that an error of up to $1 was acceptable. If I recall cor…

On my first day in a new company, not even senior dev yet, I met with the head accountant. I asked about her top problems, she said her top problem was that the application would produce different invoice on screen, different invoice when printed as PDF and a different invoice in the accounting software. About 1% of all invoices were affected but due to amount of billing they were doing (telecommunications and advert…

The hero I want to be

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#225
post #155

Earlier quoted context omitted.

I did join somewhere that could do it correctly, because they had some very long-running POS software. It could even do things like "split bill three ways" correctly allocating both the spare penny from the division and the tax calculation, such that you could add the bills back together again and get the same numbers as the split bill. Using a "money" class that stores things as integer pennies gets you a long way t…

Integer cents is fantastic for POS software and similar things that deal with at most a few thousand dollars at a time. The place where it starts to fail is when the absolute numbers get really large, not really small. Think "United States Federal Reserve" or "UBS". Then remember that some of these institutions need to deal with accounts denominated in Zimbabwean dollars.

Really small can be an issue when it gets really small e.g. tarsnap’s accounting is pretty infamously done in attodollars (1e-12). U64 only has room for 19 decimal digits so you’re limited to 7 figures up.

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#226
post #43

Earlier quoted context omitted.

I have a personal anecdote on this subject. A long time ago I worked at a bank and I had to calculate a large number of accounts regarding agricultural loans. These were state sponsored loans. When I finished my task (this was a Java job), I found that sometimes the results were off by $0.01. So I asked my boss how I should do the rounding, to which he replied that an error of up to $1 was acceptable. If I recall cor…

Exactly. I think many people start overthinking things in banking. Most accounting/finance departments are ok with rounding pennies every month. I run a Commercial Real Estate Servicing platform, where we are accruing interest on large balances daily. Our method is to not do the rounding daily, but add up all the numbers for a given period, say a month, and then round to the penny and create a single adjustment round…

Yeah. I worked on a lending platform that used floats (!!!), and their response when I brought this up was that as long as the result is within something like $10, it was not an issue.

I brought up specific math problems that floats couldn't handle and they weren't phased

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#227

I find the “no negatives” very confusing even in a double entry ledger for reasons the last sentence of that paragraph hints at: > When you need to take the net balance, the two balances can be subtracted accordingly and the net displayed as a single positive or negative number. This means you have to reconcile credits and debits using a different type than each of the columns is in. Not a huge deal by itself, but no…

Yes, we could have explained this more! (Joran from TigerBeetle here)

The motivation is to preserve information, and I think this becomes less confusing once you understand that accounting is in fact a type system.

I hope this comment makes this more clear: https://news.ycombinator.com/item?id=37571942

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#228
post #33

Earlier quoted context omitted.

What do you do if heavy deflation causes the government to release a $0.001 coin? A cent isn't a fundamental unit. Edit: as another hypothetical, what if the $0.001 coin is released to support micropayment use cases?

Worth noting that hyperdeflation has never happened, which is kind of interesting because it theoretically could.

Not sure what exactly you call hyperdeflation, but something like that has occurred in communist Czechoslovakia in 1953.

https://cs.wikipedia.org/wiki/%C4%8Ceskoslovensk%C3%A1_m%C4%...

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#229
post #90

Earlier quoted context omitted.

That “just” is doing some very heavy lifting. That could potentially involve having to update almost every financial system worldwide given the US dollar’s position as a global reserve currency.

If inflation averages 5% per year, a factor of 10^17 (what are the biggest USD notes actually in use?) is just over 800 years away, which is far enough that we might legitimately not have a moon any more let alone dollars. If hyperinflation brings that date closer, the dollar will probably also stop being a global reserve. Or possibly: will be caused by it ceasing to be a global reserve.

> 800 years away, which is far enough that we might legitimately not have a moon any more

Wait, what? 800 years is absolute peanuts for the fate of orbital bodies. Wikipedia's Timeline of the Far Future estimates the demise of the moon in 7.59 billion years; still in orbit around the Earth (albeit a much higher one), it gets destabilized by the expanding sun and eventually swallowed by it, along with the Earth. If they aren't swallowed by the sun, they estimate 65 billion years before we lose the moon in one way or another.

https://en.wikipedia.org/wiki/Timeline_of_the_far_future

Re: 64-bit bank balances ‘ought to be enough for anybody’?

#230
I once argued for using BigDecimal instead of Doubles in an invoicing software but had a hard time to come up with a practically relevant example.

Is there an example where it makes a noticeable difference (at least one cent in the final result) that does not involve unrealistic amounts or numbers of items?

I'm not arguing for Doubles, just collecting arguments to convince.

Post reply on HN