Issue #361: COST() ignores inferred_tolerance_default (blais/beancount)

11 views
Skip to first unread message

Martin Michlmayr

unread,
Jan 18, 2019, 8:23:26 PM1/18/19
to bean...@googlegroups.com
New issue 361: COST() ignores inferred_tolerance_default
https://bitbucket.org/blais/beancount/issues/361/cost-ignores-inferred_tolerance_default

Martin Michlmayr:

Let's take this example

```
2000-01-01 open Liabilities:Accounts-Payable
2000-01-01 open Expenses:Travel

2013-05-17 * "Test" "Train 1"
Expenses:Travel
Liabilities:Accounts-Payable -2.85 EUR {1.2817 USD, 2013-05-17}

2013-06-17 * "Test" "Train 2"
Expenses:Travel
Liabilities:Accounts-Payable -2.95 EUR {1.283 USD, 2013-05-17}
```

Now:

```
beancount> select date, position, balance where account ~ 'Expenses:Travel'
date position balance
---------- ---------- ----------
2013-05-17 3.6528 USD 3.6528 USD
2013-06-17 3.7848 USD 7.4376 USD
beancount>
```

So the precision is quite high. Ok, let's add

```
option "inferred_tolerance_default" "USD:0.01"
```

and now we get:

```
beancount> select date, position, balance where account ~ 'Expenses:Travel'
date position balance
---------- ---------- ----------
2013-05-17 3.65 USD 3.65 USD
2013-06-17 3.78 USD 7.43 USD
```

Ok, good.

This is for Expenses:. If we look at Liabilities, we should get the same result.

But wait:

```
beancount> select date, COST(position) where account ~ 'Liabilities:Accounts-Payable'
date cost_positi
---------- -----------
2013-05-17 -3.6528 USD
2013-06-17 -3.7848 USD
```

We still have all that precision.

And worse:

```

beancount> select SUM(COST(position)) where account ~ 'Liabilities:Accounts-Payable'
sum_cost_po
-----------
-7.4376 USD
```

which after rounding is 7.44. But expenses were 7.43!


Reply all
Reply to author
Forward
0 new messages