Im out of town looking at real estate with little time but - can you provide a minimal file that reproduces the issue? I can look on the weekend - the transaction below involves a single currency (IMHO you should not use cost syntax for this) - beancount does not use floating-point numbers - imprecise decimal calculations are performed at a specific high precision (IIRC it's the default on the decimal module)
On Mon, May 19, 2025, 14:54 Dan Andersson <[email protected]> wrote: > I think I found the culprit. > > I started commenting away directives, starting from the end, to find at > which point the bogus "Equity:Conversions" (a few dollars) starts showing > up. > This occurs immediately after including an entry that looks something like > this: > > Assets:EUR 0.000000004 EUR { 0.84379 USD } > Expenses:CapitalLoss:EUR 0.000000000004180176 USD > > What this is doing is closing down (partially or fully) a EUR lot (which > we know exists because Beancount allows me to do it without showing any > errors) and booking a loss for this lot. As you can see, very small > near-zero amounts. > > Could the sudden introduction of the bogus conversion entry (a few > dollars) be because of some *floating-point calculation issues* related > to these near-zero amounts? If so, can I increase the precision of this > calculation, so I can test if that gets rid of the bogus conversion entry? > > > > > On Monday, May 19, 2025 at 11:03:20 AM UTC Dan Andersson wrote: > >> Hi >> >> I'm on Beancount 2.3.6. >> >> First I do this: >> >> >> 1. Run `bean-query file.beancount`. >> 2. Get balance sheet: `SELECT root(account, 2), sum(position) FROM >> OPEN ON 2022-08-01 CLOSE ON 2024-01-01 CLEAR WHERE not account ~ >> 'Income|Expenses' GROUP BY 1 ORDER BY 1;` >> 3. Get income statement: `SELECT root(account, 2), sum(position) >> FROM OPEN ON 2022-08-01 CLOSE ON 2024-01-01 WHERE account ~ >> 'Income|Expenses' GROUP BY 1 ORDER BY 1;` >> 4. If I sum up everything in the income statement (by copy-pasting >> everything (they're only base currency amounts) into a separate >> calculator, >> and adding everything up), the sum is exactly the `Equity:Earnings` shown >> in the balance sheet. Great. >> 5. If I sum up all `Assets` (there are no `Liabilities`) in the >> balance sheet (by copy-pasting them into a separate calculator, >> multiplying >> non base currency quantities by corresponding base currency cost (in curly >> braces), and adding everything up), the sum is exactly the >> `Equity:Earnings` (with sign reversed). Great. >> >> Here is the issue: >> >> - *`Equity:Conversions` is some non-zero amount*. Based on how >> everything already adds up (as I showed above), I was expecting >> `Equity:Conversions` to be zero. >> >> What could be going on? >> >> Thanks, >> DA >> > -- > 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 visit > https://groups.google.com/d/msgid/beancount/56cf4075-fe8e-47b6-b285-b0fb8d508cb9n%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/56cf4075-fe8e-47b6-b285-b0fb8d508cb9n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 visit https://groups.google.com/d/msgid/beancount/CAK21%2BhM7iF2KbhxVAsrxSCg-ozRQr%3DKBw4BLrYBTmaCNvCjzxA%40mail.gmail.com.
