Rounding error causing transaction to not balance in beancount

30 views
Skip to first unread message

Tony Xiao

unread,
Oct 19, 2025, 3:17:02 PMOct 19
to Digest recipients
I feel like the following should be an extremely simple scenario, but for whatever reason, my transaction is not balancing. This is my bean file


option "inferred_tolerance_default" "IDR:0"
option "inferred_tolerance_default" "USD:0.02"
option "inferred_tolerance_default" "*:0.001"

plugin "beancount.plugins.auto_accounts"

2022-08-25 * "" "Re install gate"
Assets:Cash -3000000 IDR
Expenses:Other-Expense 204 USD @@ 3000000 IDR

This is the error I get
Transaction does not balance: (-0.000000000000000000001 IDR)Beancount(1)

I must be missing something extremely obvious about beancount rounding? 

Tony

---
Tony


Sent via Superhuman

Martin Blais

unread,
Oct 19, 2025, 10:11:46 PMOct 19
to bean...@googlegroups.com
You're setting IDR precision to zero digits, so it computes 14706 IDR/USD
Multiply it back, you get some very small error
Is Equity:Rounding to absorb this (maybe develop a plugin that asserts their numbers are always a very small value since it's scary to absorb any difference - I should have implemented that).




bean-doctor context 20251019.beancount 9
** Transaction Id --------------------------------

Hash:ece097107bd100ce28ec61a875ad4726
Location: /home/blais/q/beanbugs/user/tonyxiao/20251019.beancount:8


** Balances before transaction --------------------------------

  Assets:Cash

  Expenses:Other-Expense


** Unbooked Transaction --------------------------------


2022-08-25 * "Re install gate"
  Assets:Cash             -3000000 IDR              ;                      -3000000 IDR
  Expenses:Other-Expense       204 USD @ 14706 IDR  ; 2999999.999999999999999999999 IDR


** Transaction --------------------------------


2022-08-25 * "Re install gate"
  Assets:Cash             -3000000 IDR              ;                      -3000000 IDR
  Expenses:Other-Expense       204 USD @ 14706 IDR  ; 2999999.999999999999999999999 IDR


** Residual and Tolerances --------------------------------

Residual: (-0.000000000000000000001 IDR)
Tolerances: IDR=0, USD=0.02


** Balances after transaction --------------------------------

* Assets:Cash                                                  -3000000 IDR

* Expenses:Other-Expense                                            204 USD


--
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/mgy35mu1.3e56da89-794d-4145-afa3-65b661e9c5b5%40we.are.superhuman.com.
Reply all
Reply to author
Forward
0 new messages