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

amounts in value reports can sometimes be shown unstyled / with zero decimal digits #2105

Closed
simonmichael opened this issue Oct 27, 2023 · 1 comment · Fixed by #2111
Closed
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. valuation

Comments

@simonmichael
Copy link
Owner

simonmichael commented Oct 27, 2023

This is a potentially surprising behaviour noted in hledger manual > More valuation examples, circa version 1.31.

Here, A's value in B is 0.5B, and a valued print report shows it as expected:

P 2023-01-01 A 0.5B

2023-01-01
  a    1A
  b
$ hledger-1.31 print -X B
2023-01-01
    a            0.5B
    b           -0.5B

Here is the same transaction, but this time the rate is inferred
by reversing the declared B to A price, and there's no B amount
written in the journal from which to infer a display precision,
so B is displayed with the default style (symbol on the left)
and precision (0 decimal digits).
(Also, because the displayed amount looks like zero, no minus sign
is displayed, and before 1.30 the symbol was not displayed either.)

P 2023-01-01 B 2A

2023-01-01
  a  1A
  b
$ hledger-1.31 print -X B
2023-01-01
    a              B0
    b              B0

Other reports are similarly affected:

$ hledger-1.31 bal -E -X B
                   0  a
                   0  b
--------------------
                   0  
@simonmichael simonmichael added A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. valuation labels Oct 27, 2023
simonmichael added a commit that referenced this issue Nov 8, 2023
…ngeddon)

`print -V` and other value reports now tend to show valued amounts
with the precision of the market price that was used to calculate them
(showing all significant decimal digits).

And new tests have been added describing and explaining various
style/precision behaviours in print cost/value reports.
simonmichael added a commit that referenced this issue Nov 8, 2023
… precisiongeddon)

Cost/value conversion now applies the standard display style, and
sets the display precision equal to the internal decimal precision
(or 8 if the decimal appears to be infinite).
This means value reports and especially `print -V` now show amounts
with more accurate and standard style and precision.

New tests have been added describing and explaining various
style/precision behaviours in print cost/value reports.
@simonmichael
Copy link
Owner Author

Fixed by #2111.

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. valuation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant