Rounding formula for automatic transactions

2012-01-06 Thread André Coelho
Hello, Is it possible to specify the rounding formula in a automatic transaction? My specific case is that of tithe, I know I might be nitpicking, but still, I think it would be useful to have a way to say, always round up in the X decimal place, or always round down. Here is an example:

Re: Rounding formula for automatic transactions

2012-01-06 Thread Zack Williams
Is it possible to specify the rounding formula in a automatic transaction?  My specific case is that of tithe, I know I might be nitpicking, but still, I think it would be useful to have a way to say, always round up in the X decimal place, or always round down.  Here is an example: I get

Re: Rounding formula for automatic transactions

2012-01-06 Thread Craig Earls
The best way is to use a value expression in your automatic transaction: = /^Income/ (Liabilities:Tithe) (0.1 * round(amount)) Unfortunately, round doesn't seem to let you control the precision so you won't notice much since it will round to two digits. I have another request to allow user

Re: Rounding formula for automatic transactions

2012-01-06 Thread André Coelho
I've seen a floor function, but it seems to actually round to the nearest integer (not a floor as I'm used to). I wonder how do you manage precision, I would think this should be critical, how do you guys deal with that? Andre.

Re: Rounding formula for automatic transactions

2012-01-06 Thread Craig Earls
Precision is handled internally to ledger. It keeps as many digits as the most precise number it has gotten for that commodity. As an experiment, enter four significant figures for you primary commodity somewhere in any posting (for example $13.4500 instead of $13.45). Your balance reports will

Re: Rounding formula for automatic transactions

2012-01-06 Thread Craig Earls
Actually, after further thought this is not as accurate as you might want. If you are looking to calculate 0.1 of your total increase rounded to the nearest dollar that is different than summing the rounding of all the individual increases. Ideally you would apply the rounding on the reporting

Re: Rounding formula for automatic transactions

2012-01-06 Thread Craig Earls
Here is the format string I mentioned. This is for the cleared report. It colorizes lines whose cleared and uncleared balances aren't equal, and uses the floor function on any account with Owed in the name. For me that means Tithe Owed. --format %(ansify_if( justify(depth_spacer +

Re: Rounding formula for automatic transactions

2012-01-06 Thread John Wiegley
Craig Earls enderw88-re5jqeeqqe8avxtiumw...@public.gmane.org writes: Unfortunately, round doesn't seem to let you control the precision so you won't notice much since it will round to two digits. I have another request to allow user controlled precision, but maybe John has a different

Re: Rounding formula for automatic transactions

2012-01-06 Thread John Wiegley
André Coelho andrecoelho-re5jqeeqqe8avxtiumw...@public.gmane.org writes: I've seen a floor function, but it seems to actually round to the nearest integer (not a floor as I'm used to). I wonder how do you manage precision, I would think this should be critical, how do you guys deal with