How is precision for reports determined?

48 views
Skip to first unread message

James Cook

unread,
Jun 3, 2020, 9:40:33 PM6/3/20
to bean...@googlegroups.com
I noticed that if I have any transactions with whole USD usd amounts,
both bean-web and fava start reporting balances with zero digits of
precision (e.g. -7 instead of -6.97). If I comment out those
whole-number transactions, I get two digits, probably because my other
transactions have two digits.

Is that expected behaviour? If it's a bug, I'm happy to try to put
together a minimal reproducible example.

I'm mostly asking because I don't see it documented anywhere, but if
there's a way to override it (e.g. with metadata attached to a
commodity directive) I'd be interested to hear.

James

Martin Blais

unread,
Jun 3, 2020, 10:13:05 PM6/3/20
to Beancount
Beancount runs statistics on your inputs, and attempts to figure out the desired 
- tolerance (for balancing transactions and interpolation)
- precision (for rendering numbers)
In v3 this will get completely redesigned and better documented, it's a constant source of confusion.
In the meantime I want to add a new option that allows you to set the tolerance and precision explicitly.
It isn't entirely obvious because there are different parts of the code that render numbers (bean-query, reports, and the web interface) and they're in different states of using these precisions.


--
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 beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAHpmPOCDh%2Bc%3D4pdEWTS114%2BXg_Q%2B620sN4Cd3UhR-Uhoxhy-8A%40mail.gmail.com.

James Cook

unread,
Jun 3, 2020, 11:09:19 PM6/3/20
to bean...@googlegroups.com
Thanks, explicit options would be nice. For now I'll just add .00 to the amounts; that seems to fix the display precision.

I've also been able to work around the lack of an explicit tolerance option, because at the moment my preference is zero tolerance everywhere so I can just say 'option "inferred_tolerance_multiplier" "0"'.

BTW, I'm really enjoying Beancount's simplicity and deliberately small set of features. It gives me confidence that I can understand what it's doing and it won't do anything too unexpected even if I come up with some creative ways to use it. (I'm hoping to follow up later on the other message I sent about tracking multiple different ways of accounting. I ended up solving it to my own satisfaction with some extra currencies and a small plugin.)

James



Reply all
Reply to author
Forward
0 new messages