On Mar 10, 5:15 am, John Wiegley <[email protected]> wrote: > >>>>> Robert Lehmann <[email protected]> > >>>>> writes: > > The automatic transaction (1%) should generate a post of $0.04 and one of > > $0.03 (which it does!). Then, when adding those posts for balance/ > > registers, it instead seems to sum up $0.044 and $0.033 (which is $0.077 and > > rounds up, instead of rounding down two times): > > This is expected behavior. Ledger never rounds internally, as all values are > kept as rational numbers. It only converts them to decimal floating point -- > and performs rounding -- to *display* figures; but never to perform math on > them. > > If you want the kind of rounding you're describing, you can use this: > > = /Expenses:Bug Fixes/ > Liabilites:Refactoring (truncated(amount) * 0.01)
That seems like the Right Thing To Do(TM) as I'm trying to compute taxes using automatic transactions and my collected sales tax is precise to cents only, too. However, with Ledger 3.0.0-20120217 (the one available from the Ubuntu PPA) the above expression fails for me (after enclosing the account in either [] or () to balance, because it seems to fail otherwise with Ledger3) with the following error: While applying automated transaction from "bug.ledger", lines 1-2: > = /Expenses:Bug Fixes/ > (Liabilites:Refactoring) (truncated(amount) * 0.01) While extending transaction from "bug.ledger", lines 4-6: > 2012/03/09 Automatically Incurring 0.044 Refactoring > Expenses:Bug Fixes 4.40$ > Assets:Code Error: Amount expressions must result in a simple amount When I use the documented `truncate` function instead (truncated is not mentioned in the manual page that ships with the Ubuntu package?) the error is "Error: Unrecognized truncation style: '4.40$'". Thanks for your help so far, Robert
