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…
64-bit bank balances ‘ought to be enough for anybody’?
221–230 of 372 posts
Re: 64-bit bank balances ‘ought to be enough for anybody’?
#222Earlier 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
Re: 64-bit bank balances ‘ought to be enough for anybody’?
#223Specialising 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,…
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’?
#224Earlier 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…
Re: 64-bit bank balances ‘ought to be enough for anybody’?
#225Earlier 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.
Re: 64-bit bank balances ‘ought to be enough for anybody’?
#226Earlier 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…
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’?
#227I 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…
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’?
#228Earlier 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.
https://cs.wikipedia.org/wiki/%C4%8Ceskoslovensk%C3%A1_m%C4%...
Re: 64-bit bank balances ‘ought to be enough for anybody’?
#229Earlier 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.
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.
Re: 64-bit bank balances ‘ought to be enough for anybody’?
#230Is 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.