On Thursday, 8 May 2014 06:03:40 UTC+5:30, John Wiegley wrote: > > >>>>> tripun goel <tri...@gmail.com <javascript:>> writes: > > > The point to note is that Ledger-CLI uses multiple precision floating > point > > numbers via MPFR library. > > Hi Tripun, welcome to Ledger development. :) >
Thanks > > Ledger-CLI does not use multiple precision floating point numbers. It > uses > multi-precision integer rationals. The only time MPFR is used is in > exactly > one place: rendering an integer rational as a floating-point string. No > rounding occurs internally -- only at report time, which is deferred until > the > last possible moment. > > As you told ledger uses integer rationals for internal representation and MPFR to convert to floating point string. But for accounting as Brad said what matters is reporting. I saw an option --unround to perform unrounded calculations. But here is something : I tried this transaction 2014/03/21 * Test Round off Expenses 1 EUR @ $0.0086 Expenses 1 CAD @ $0.0083 Income and the result is ledger -f legtest/round.txt --unround -V -E balance 0 Expenses $-0.0169 Income -------------------- 0 without unround ledger -f legtest/round.txt -V -E balance 0 Expenses 0 Income -------------------- 0 and then 2014/03/21 * Test Round off Expenses 1 EUR @ $0.0086 Expenses 1 CAD @ $0.0083 Income $0.0 the result with or without unround is the same ledger -f legtest/round.txt -V -E balance 0 Expenses 0 Income -------------------- 0 2014/03/21 * Test Round off Expenses 1 EUR @ $0.0086 Expenses 1 CAD @ $0.0083 Income $0.00 and the result comes with or without unround option ledger -f legtest/round.txt -V -E balance While parsing file "/home/test/legtest/round.txt", line 5: While balancing transaction from "/home/test/legtest/round.txt", lines 2-5: > 2014/03/21 * Test Round off > Expenses 1 EUR @ $0.0086 > Expenses 1 CAD @ $0.0083 > Income -$0.00 Unbalanced remainder is: $0.02 Amount to balance against: $0.0169 Error: Transaction does not balance The point to note is although the amount remains exact within a transaction , it is later rounded to highest display precision available. The unround option simply does not work if precision of your amount is less than what is required and the same result is carried of for later For example I tried the following 2014/03/21 * Test Round off Expenses 1 EUR @ $0.0086 Expenses 1 CAD @ $0.0083 Income -$0.0 2014/03/21 * Test Round off Expenses 1 EUR @ $0.0086 Expenses 1 CAD @ $0.0083 Income -$0.02 2014/03/21 * Test Round off Expenses 1 EUR @ $0.0086 Expenses 1 CAD @ $0.0083 Income -$0.0169 and the result is with or without unround ledger -f legtest/round.txt --unround -V -E balance $0.0507 Expenses $-0.0369 Income -------------------- $0.0138 Did you notice that Income of $0.0169 which was from the first transaction is missing in the final result. Not to mention that the precision of lot prices is ignored for which bug 992 is filed. Will it not be good to have a precision option to set this precision (if for display and for calculations). This provide flexibility to customize and set the precision required in reporting and calculations. It does not matter to the accountants what the internal storage is (however we are relieved) but this result will definitely make them cautious. Is such an option available already? Regards Tripun Goel -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.