3 ms·
That’s an application design choice, not a minimum. An alternative is to work internally in one unit and convert at format time.
by tightbookkeeper 2y ago
That’s an application design choice, not a minimum. An alternative is to work internally in one unit and convert at format time.
- maest 2y agoThat is not a viable alternative.
- serial_dev 2y agoEven though my gut reaction is to agree with you, it’s true that it is an app design decision, so in certain scenarios it might very well be a good design decision.
- tightbookkeeper 2y agoShipped applications disagree with you.
- dmoy 2y agoIt really depends on the context of the app Sometimes you can do all calculations in a single currency and convert at reporting time. I've worked on teams where that was fine. Sometimes... you really cannot do that.
- tightbookkeeper 2y agoCompletely agree.
- Phrodo_00 2y agoMight be a minimum for a money library (not completely sure what the absolute minimum would be). It would be an application design choice to not use one and stick to general fixed point/Big Num constructs.
- V41frQo1SccpfHI 2y agoOut of curiosity, how do you deal with changing exchange rates in that case?
- amoshebb 2y agoit depends, if it was a currency exchange, it'll be labeled in one of 3 ways, either average rate per unit, absolute, or it'll be a reference to a MSSQL table containing exceptional spot transactions. Otherwise, a complete history of exchange rates is stored in KDB, most days you can take the average, and for small amounts on weekends or days the exchange is closed you can just interpolate, there's also a half dozen XLSXs full of certain exceptional days, so you'll have to check that you're not on one of those lists. Then if you're not dealing with USD->X or CAD->USD->X things start to get hairy.
- tightbookkeeper 2y agoYou never want to be lossy with user inputs. Save what they told you and then convert for internal logic. The OP just described a language feature where you want to multiply euros with usd one place and yen and dinar in another. You don’t need to do that which is why a decimal or 64 bit int is a fine language approach.
- knodi123 2y agoWe store all our financial data in Greenwich Mean Dollars.
- irq-1 2y agoWhat are you going to do about the new Moon Dollars?