Oh <poop> indeed, that looks like a bug.
What's happening is that division will be processed by the parser and
produce the full 28 decimal digits of precision, and that it used as input
for tolerance inference (and it shouldn't be IMO) and then because your
other amount is an integer (331) it doesn't contribute to the tolerance
inference. I need to find a solution for this, probably disable inference
from computed numbers... this is a case where the per-transaction tolerance
inference fails - congratulations you've found a bug.

In the meantime, changing your first amount from -331 SUD to -331.00 USD
should do the trick, because it'll expand the tolerance on USD to 0.005 and
that's enough

Tracking bug:
https://bitbucket.org/blais/beancount/issue/56/figure-out-how-to-disable-tolerance




On Wed, Jun 10, 2015 at 12:03 PM, <[email protected]> wrote:

> I'm not sure I understand how the divide operator interacts with the
> recent tolerance changes, if it does. For example, if I do this:
>
> --------------------------------------------------------
> option "title" "Main accounts"
> option "operating_currency" "USD"
>
> 1999-01-01 open Liabilities:Credit-Card
> 1999-01-01 open Expenses:Utility-Bill
>
> 2000-01-01 * "Power company"
>    Liabilities:Credit-Card          -331 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
>    Expenses:Utility-Bill            331/12 USD
> --------------------------------------------------------
> I get: bean-check output:
> divide.bc:7:   Transaction does not balance: (-2.8E-25 USD)
>
> Is there a recommended way to handle such situations without having to add
> an explicit rounding error posting?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/a1b520d1-1039-43d2-8054-58411e5e1e9e%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/a1b520d1-1039-43d2-8054-58411e5e1e9e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
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.

Reply via email to