* Martin Blais <[email protected]> [2014-06-23 22:46]: > So far all of the examples you brought up point to an obvious > implementation choice: > > "Rounding should occur at the point of calculating the "balance amount", > that is, the amount that is used to balance against the rest of the > postings of the transaction."
Right, I believe that's correct, as long as it's done for each transaction and not just once at the end when doing a balance. > > in most real-life scenarios, we want to round to 2 digits of > > precision. > I think the question should be phrased in terms of what precision you want > to represent numbers _internally_. Isn't a worthy goal to attempt to > replicate the same precision as the real-world accounts they represent? Right, I definitely agree. I mentioned 2 digits above since this will be the precision of most real-world accounts, but I agree that the precision from the real-world accounts should be reflected internally. At the moment, ledger internally stores data with all precision -- I want an option to limit precision stored internally to the desired precision (according to what the real-world account uses). > But I can imagine that some companies just truncate: so even if you > > should get 1.126, they would give you 1.12 instead of 1.23. (I don't > > actually know if this is true, but it might be.) > > I doubt it; this is a common problem. That bank would have to have _really_ > bad developers for this to be the case. In your researching previous work, > you might want to dig into banking regulation law, there might be something > in there that mentions this. I wonder if you call your bank to ask them how > they do it if they'd share... you're a customer after all. Fun experiment. Yeah, would be interesting to know how this is handled in real life... does anyone know? > I have a use case for this: a real-world currency trading account which > rounds its precision at 4 digits instead of the customary two. Amounts are > tracked in US dollars. Transfers in and out are using two digits, but > internally, four are preserved. (This is an argument against specifying it > by commodity.) Ok, good to know. Thanks! I think specifying it by commodity still makes sense, but an account directive should be able to override it. > > currencies where 600 would be rounded to 1000? (I'm thinking of > > currencies where one million or billion is worth $1 or so). The > > proposal assumes that rounding only happens after the decimal point > > but maybe this assumption is wrong. > > There's a lot of crazy stuff out there... I forget which it is, but I once > heard of an exotic currency that rounds at multiples of 5 in its integer > amount that gave some friends working in a financial institution an > implementation headache. (Personally I feel that you have to support > everything, others may disagree.) Interesting. ledger is very flexible so it would be nice to be a flexible as possible. At the same time, the common cases should be as easy possible. -- Martin Michlmayr http://www.cyrius.com/ -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
