Hello,

I have encountered some surprising (to myself) effects of setting locale in 
a ledger-based Python program. I put up a minimal repro program and a 
somewhat extensive description of what I have found at 
https://github.com/porridge/ledger-issue-repro/tree/main/03-setting-locale-changes-precision

It would be great if someone could confirm my conjectures and answer some 
questions. I am pasting them below for convenience.

I did read the Journal File Format for Developers 
<https://www.ledger-cli.org/3.0/doc/ledger3.html#Journal-File-Format-for-Developers>
 
section of the documentation, but some things are still a mystery:

   1. Why does query() return a different set of postings depending on the 
   locale, while .xact.posts() always returns three? I suspect this is 
   because query() omits postings whose is_zero() returns True, while 
   .xact.posts() always returns all postings?
   2. Why is the result of is_zero() on a value of 0.000346 
   locale-dependent? I suspect that the locale-specified precision somehow 
   influences that decision. However I cannot see anything in the output of 
   localeconv() that could cause precision to go so high (frac_digits is 
   just 2).
   3. Why does the precision of the commodity price go as high as 18?
   4. What is the meaning of the value returned by truncated()? It seems to 
   make no sense at all for all but one posting in the locale-enabled cases.


regards,
Marcin

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/ce0a2043-c1e2-4264-9817-6b99c472e86cn%40googlegroups.com.

Reply via email to