5 ms·
It's always struck me as strange than finance folk don't want correct math. They want math that matches the coins in their pocket. If I am owed 2.575% on $3425
by JoeAltmaier 8y ago
It's always struck me as strange than finance folk don't want correct math. They want math that matches the coins in their pocket.
If I am owed 2.575% on $3425956.57 for 245 months, why not get the correct sum instead of some rounded monthly sum added up? Its just strange.
- jimktrains2 8y agoHow would you pay such a non-integer sum?
- JoeAltmaier 8y agoWith a bank balance on a computer.
- dmoy 8y agoCan computer bank balances store fractional cents right now? At least before, this was not possible.
- black-tea 8y agoThe question is can computers do arbitrary precision arithmetic. Technically you'd need infinite memory, but if you use fractions to represent amounts, as is correct, then practically speaking, yes you can. One accounting system that uses fractions is ledger[0]. [0] https://www.ledger-cli.org/ https://www.ledger-cli.org/
- JoeAltmaier 8y agoSix or seven digits of precision (like all floating point) is good enough, and far better than exactly 2 digits of decimal. Millions of times better. Fractions do little for interest rates, which are transcendental functions and sometimes even irrational.
- paulie_a 8y agoIf you are using floats in financial transactions you are doing it incredibly wrong. Never use floating points for that, ever. It is insanely problematic and bug prown.
- JoeAltmaier 8y agoYes it doesn't match the ad-hoc stuff finance people do. That's in fact my point.
- dmoy 8y agoThat's not how floating point works though. The precision is by definition floating. With a sufficiently large number, your least significant bit of precision might be in the 10s or 100s or more of dollars (or whatever currency). Your issue then is that if you combine a large enough number with anything, then you get precision loss and money just starts disappearing (or appearing out of nowhere). Even if your hyperinflation was over ten orders of magnitude less bad than Zimbabwe's (decimal orders of magnitude even), you would run into floating point precision loss with a 64 bit floating point number.
- JoeAltmaier 8y agoA double has 15 digits. Which counts more money than exists anywhere added up. Not a problem I'm thinking?
- jimktrains2 8y agoAnd ieee floating point still can't store 10¢ exactly.
- dmoy 8y agoI dunno, South korea's M2 would need 17 or 18 digits to represent I think. Edit: Japan too. Say south korea has a few years of hyperinflation, not even anywhere close to zimbabwe bad, and you'd have money disappearing right & left.
- 8y ago
- sdinsn 8y agoThey must be able to, since brokers often use fractions of cents for penny stocks.
- black-tea 8y agoI always do my accounts exactly but then have to round up or down to make settlements. This can leave some "dust" in my accounts which I might eventually move to a losses account but I prefer to do things properly. For example, if I borrow money from someone I'll agree on an interest rate and calculate the interest (compounded continuously). If it turns out the interest is something like 1.01521 then I'll pay 1.02 and leave the account in the negative. I'll move it to losses if I never expect to transact with that entity again but if I do then things will work out exactly given enough time.
- toolslive 8y agoThey have it in COBOL,which uses binary coded decimals to represent the number (1 decimal per nibble) so numbers like 0.3 can be represented without loss of accuracy. It was abandoned in favour of IEEE754.
- JoeAltmaier 8y agoI think that was a holdover of EBCDIC, an old IBM standard. In fact early IBM machines did BCD in their ALU.
- jandrese 8y agoBCD mode was a popular in a lot of early chips. It's an esoteric feature today, but on 16 bit machines you would blow out the ALU way too easily and get into messy two word math.
- justincormack 8y agox86 still has BCD support, in 32 bit mode http://www.hugi.scene.org/online/coding/hugi%2017%20-%20coaax.htm http://www.hugi.scene.org/online/coding/hugi%2017%20-%20coaa...
- Const-me 8y ago> If I am owed 2.575% on $3425956.57 for 245 months, why not get the correct sum Explosion of storage space and computation complexity. When you combine real-world numbers with compound interest, every time you add the interest, you’re adding decimal digits to the value. For your example, after 245 months of compound interest at 2.575% per month, the value will have 1228 decimal digits in it, that’s more than 512 bytes to store and process. Another reason is, for the last ~700 years, finance folks use this: https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system https://en.wikipedia.org/wiki/Double-entry_bookkeeping_syste... With that system, coins allow for some kind of rolling checksum verification. BTW, in modern software, the coin is often $/€/whatever 0.0001.
- stcredzero 8y agoThe thing is, laws and regulations around finance and things like gas/petroleum delivery scheduling predate electronic 32 bit computers with floating point math. This used to cause problems at a former workplace, because the "math" in the regulations around scheduling used tables, so the functions were highly non-linear, and less math savvy customers would complain that reversals of calculations wouldn't work as expected. If we had used continuous functions, it would have worked out, but then we would have been going against regulations.
- nitwit005 8y agoBecause cash is obviously still a thing? Be glad we at least have a decimal based coinage system these days. We'd all have such fun dealing with fractions.