Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.31: amounts from balance assignments not contributing to inferred precision #2091

Closed
PSLLSP opened this issue Sep 23, 2023 · 4 comments
Closed
Assignees
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. bounty Thar's some kind o' loot on offer.. regression A backwards step, indicating a weakness in our QA. We don't like these.

Comments

@PSLLSP
Copy link

PSLLSP commented Sep 23, 2023

$ hledger --version
hledger 1.31, linux-x86_64

I see several issues. I am not sure, maybe it is just rounding, was something changed in newer hledger??

First, balances are rounded, like 5014 USDT on the last line should be 5013.7654234 USDT

$ hledger -f demo-bug.journal bal
             -12 BTC
            -100 LTC
          -5000 USDT  assets:cryptobank:acc1
              -2 BTC  income:stacking:btc
              -9 LTC  income:stacking:ltc
            -14 USDT  income:stacking:usdt
              14 BTC  liabilities:stacking:btc
             109 LTC  liabilities:stacking:ltc
           5014 USDT  liabilities:stacking:usdt
--------------------
                   0  

Second, some auto entries are missing (replaced with 0). Could be related to rounding? 0.123456 BTC is rounded to 0; you can send me 0.123456 BTC, it has no value... ;-) Oh wait, 0.49 BTC would be better, I will update this ticket with BTC address...

$ hledger -f demo-bug.journal reg
...
2023-09-01 demoBTC|invest                                assets:cryptobank:acc1                               -2 BTC        -2 BTC
                                                         liabilities:stacking:btc                              2 BTC             0
2023-09-15 demoBTC|status - BUG is HERE!! income:stac..  income:stacking:btc                                       0             0
                                                         liabilities:stacking:btc                                  0             0
2023-09-15 demoLTC|status                                income:stacking:ltc                                  -6 LTC        -6 LTC
                                                         liabilities:stacking:ltc                              6 LTC             0
...

The same data in older hledger (hledger 1.12.1), bug is still there but some numbers are not rounded:

2023/09/01 demoBTC|invest                               assets:cryptobank:acc1                                -2 BTC        -2 BTC
                                                        liabilities:stacking:btc                               2 BTC             0
2023/09/15 demoBTC|status - BUG is HERE!! income:sta..  income:stacking:btc                                        0             0
                                                        liabilities:stacking:btc                        0.123456 BTC             0
2023/09/15 demoLTC|status                               income:stacking:ltc                                   -6 LTC        -6 LTC
                                                        liabilities:stacking:ltc                        5.654321 LTC             0

DEMO journal, demo-bug.journal:

######
2023-09-01 demoBTC|invest
  assets:cryptobank:acc1
  liabilities:stacking:btc        10 BTC

2023-09-01 demoLTC|invest
  assets:cryptobank:acc1
  liabilities:stacking:ltc       100 LTC

2023-09-01 demoBTC|invest
  assets:cryptobank:acc1
  liabilities:stacking:btc        2 BTC

######
2023-09-15 demoBTC|status - BUG is HERE!! income:stacking:btc is 0...
  income:stacking:btc
  liabilities:stacking:btc      = 12.123456 BTC

2023-09-15 demoLTC|status
  income:stacking:ltc
  liabilities:stacking:ltc      = 105.654321 LTC

######
2023-09-17 demoUSDT|invest
  assets:cryptobank:acc1
  liabilities:stacking:usdt        4000 USDT

######
2023-09-18 demoUSDT|invest
  assets:cryptobank:acc1
  liabilities:stacking:usdt        1000 USDT = 5000 USDT

######
2023-09-20 demoBTC|status
  income:stacking:btc
  liabilities:stacking:btc      = 14.176543 BTC

2023-09-20 demoLTC|status
  income:stacking:ltc
  liabilities:stacking:ltc      = 109.24681 LTC

2023-09-20 demoUSDT|status
  income:stacking:usdt
  liabilities:stacking:usdt     = 5013.7654234 USDT

######
P 2023-09-23 LTC  65.21999998 USD
P 2023-09-23 BTC  26639.99999947 USD
P 2023-09-23 USDT 1.00 USD
@PSLLSP PSLLSP added the A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. label Sep 23, 2023
@simonmichael
Copy link
Owner

Hi, which version was working for you before, so I can compare ? Were you actually on 1.12 ?

@simonmichael
Copy link
Owner

I see that 1.31 register shows less decimal digits than 1.30 here. I'll investigate, thank you!

@simonmichael simonmichael added the needs:debugging To unblock: needs debugging/investigation label Oct 10, 2023
@simonmichael simonmichael removed the needs:debugging To unblock: needs debugging/investigation label Oct 14, 2023
@simonmichael simonmichael self-assigned this Oct 14, 2023
@simonmichael simonmichael added needs:testing To unblock: needs more developer testing or general usage needs:changes To unblock: needs some changes made, in line with recommendations labels Oct 14, 2023
@simonmichael
Copy link
Owner

@PSLLSP , it took quite a while (there's a lot of confusing precision-related work going on), but yes this seems like a clear regression in 1.31, which tests did not cover. Thank you very much! Claim your http://hledger.org/regressionbounty when convenient. I have pushed the fix to master and hopefully will release a 1.31.1 before long.

@simonmichael simonmichael added regression A backwards step, indicating a weakness in our QA. We don't like these. and removed needs:testing To unblock: needs more developer testing or general usage needs:changes To unblock: needs some changes made, in line with recommendations labels Oct 14, 2023
@simonmichael simonmichael reopened this Oct 14, 2023
@simonmichael
Copy link
Owner

simonmichael commented Oct 14, 2023

PS here's a shorter repro:

2023-01-01
  (a)        1 A

2023-01-02
  (a)              = 2.2 A

comment
# 9. Posting amounts inferred from balance assignments should contribute to inferred commodity styles. (#2091)
$ hledger -f- reg
2023-01-01                      (a)                          1.0 A         1.0 A
2023-01-02                      (a)                          1.2 A         2.2 A

@simonmichael simonmichael changed the title bug in income, some "auto" entries are 0; rounding related issue? bug in income, some "auto" entries are 0; rounding related issue? (1.31) Oct 14, 2023
@simonmichael simonmichael changed the title bug in income, some "auto" entries are 0; rounding related issue? (1.31) amounts from balance assignments not contributing to inferred precision (1.31) Oct 15, 2023
@simonmichael simonmichael added the bounty Thar's some kind o' loot on offer.. label Nov 23, 2023
@simonmichael simonmichael changed the title amounts from balance assignments not contributing to inferred precision (1.31) 1.31: amounts from balance assignments not contributing to inferred precision Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. bounty Thar's some kind o' loot on offer.. regression A backwards step, indicating a weakness in our QA. We don't like these.
Projects
None yet
Development

No branches or pull requests

2 participants