beancount throws exceptions for amounts over 1 billion

100 views
Skip to first unread message

Justus Pendleton

unread,
Dec 20, 2025, 8:49:24 PM12/20/25
to Beancount

# Allow precision for numbers as large as 1 billion in addition to
# the required number of fractional digits.
#
# TODO(blais): Review this to assess performance impact, and whether
# we could fold this outside a calling loop.
ctx.prec = num_fractional_digits + 9

The result is that any amount over 1 billion (e.g. in a bean-query) results in an exception:

decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]

For my personal usage I can just increase the 9 to a 12 or whatever I need but I wanted to ask if there's a better approach so I can try to submit an actual patch?

Cheers,
Justus

Martin Blais

unread,
Dec 21, 2025, 12:49:45 PM12/21/25
to bean...@googlegroups.com
That's when you know you've made it! Congratulations Justus, you may be the first billionaire on this list.

I wish for a reproduction of the original bug, I don't recall what caused the issue.
Even my comments read cryptic to me now.
I'd be tempted to remove this, but a more conservative approach would be to bump it.
I did a quick check on print, I don't see any impact.





--
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 visit https://groups.google.com/d/msgid/beancount/2d2e78cb-8352-4ebc-a366-fd508a4e509fn%40googlegroups.com.

Eric Altendorf

unread,
Dec 21, 2025, 12:55:33 PM12/21/25
to bean...@googlegroups.com

Justus Pendleton

unread,
Dec 21, 2025, 3:15:33 PM12/21/25
to Beancount
On Monday, December 22, 2025 at 4:19:45 AM UTC+10:30 bl...@furius.ca wrote:
That's when you know you've made it! Congratulations Justus, you may be the first billionaire on this list.

Alas, 1 billion VND is only about $38,000 USD. The joys of years of extremely high inflation on a currency. Most property near a major city is easy worth a billion these days. And a good salary for a senior developer can approach 100 million.

Reply all
Reply to author
Forward
0 new messages