Hello,
There is some strange behaviour with include directive.
For example with those two files
cat <<EOF >example.beancount
1970-01-01 open Expenses:MyExpense
1970-01-01 open Assets:MyAccount
1970-01-02 *
Expenses:MyExpense 1000.00 EUR
Assets:MyAccount -1000.00 EUR
1970-01-02 * "Verif "
Expenses:MyExpense 333.0000000000000182076576039 EUR
Assets:MyAccount -333.0000000000000182076576039 EUR
EOF
cat <<EOF >example_with_include.beancount
include "example.beancount"
EOF
The results differ when we use the include file or not.
In the case without include (bean-query example.beancount 'SELECT *')
I have a stack trace with this error
decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]
In the case with include I have an output
$ bean-query example_with_include.beancount 'SELECT *'
date f narrat position
---------- - - ------ -----------------------------------
1970-01-02 * 1000.00 EUR
1970-01-02 * -1000.00 EUR
1970-01-02 * Verif 333.0000000000000182076576039 EUR
1970-01-02 * Verif -333.0000000000000182076576039 EUR
I stumbled on this while splitting some beancount ledger on multiple
files. In my case the transaction with a lot of decimal is generated by
a plugin which makes some division of existing postings to split them
between several accounts.
dest_amount=core.amount.mul(original_posting.units, core.number.D(1/3))
In this case I have the following outputs :
$ bean-query exPlugin.beancount 'SELECT * WHERE account ~ ":A"'
date f narrat position
---------- - - ------ ----------
1970-01-02 * Verif 333.33 EUR
$ bean-query exPlugin_with_include.beancount 'SELECT * WHERE account ~ ":A"'
date f narrat position
---------- - - ------ ---------------------------------
1970-01-02 * Verif 333.3333333333333148296162562 EUR
The directive are exactly the same in both cases. The only change is
that in the first case I have only one file and in the second case I
have the transaction in an included file.
I like more the first version (with proper rounding) but what triggers
me is the lack of coherence.
Have you any explanation or workaround about this ?
I use Beancount 2.2.3+hg20200223.0.3af921a
François
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/20201115172254.7xtksqidbiwp2kjd%40fjo-extia-HPdeb.example.avalenn.eu.